猫史档案馆


献代码 慢走不谢

用户:爱学习的天狗爱学习的天狗查看:0 回复:1 评论:0 创建时间:2023-02-10T22:08:01


献上代码——

 


(async function(){  
    while(true){         
        world.querySelectorAll(".d").forEach((e)=>{             
            e.meshOrientation.copy(e.meshOrientation.rotateY(Math.PI/250))     
        });       
        await sleep(1); 
           

    } 
    })()

world.onPlayerJoin(({entity})=>{
    if(entity.player.name == Admin){//要改成你的名字,单引号里的
        entity.player.walkAcceleration=0.9;//加速挂(走)
        entity.player.walkSpeed=10;//加速挂
        entity.player.swimAcceleration=1//加速挂(游泳)
        entity.player.swimSpeed=3//加速挂
        entity.player.flyAcceleration=2//加速挂(飞行)
        entity.player.flySpeed=3//加速挂
        entity.player.runAcceleration=2//加速挂(跑)
        entity.player.runSpeed=4//加速挂
        entity.player.canFly = true;//飞行
        entity.player.A=喵00000000;//伤害
        entity.player.hp =喵0000
        entity.player.enableDamage=false;//喵
        world.say(`创作者${entity.player.name}已开挂`)
    }
})
const Admin = ['TQ.喜悦的天狗ao','TDS尹子','海默喵_肖恩','天无灵应','一只正在诈尸的创作喵yee)','绝对-代码喵(全能岛民)','天无灵应','仙.鹤.','TQ.打豆豆','卢娜洛夫古德','庄轩睿','计算机鬼谷八荒','SWA机灵的飞电鼠3FI0']



/*
留言:格式:@某某某(留言对象,留给全部人的就@所有人):(正文)——(自己的名字(这个不会没有吧………………))
留言:@所有人:请在下面留言,看完留言就把那一行所有内容删掉(别连“留言:”也删掉),然后在那行打一个已看。——天无灵应
留言:@天狗,我给你这个也弄了一下
留言:https://box3.codemao.cn/e/2792d89887eb12a46a01
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
留言:
*/

const BAN = ['乐大王','啊哈哈哈哈哈']//可以填被永久封禁者的昵称,boxId,userKey
world.onPlayerJoin(({ entity }) => {
    if(BAN.includes(entity.player.name)||BAN.includes(entity.player.boxId)||BAN.includes(entity.player.userKey)){
        entity.player.kick();
        world.say(`[系统]玩家${entity.player.name} boxID:${entity.player.boxId} userKey:${entity.player.userKey} 已被永久封禁,已踢出地图!`);
    }
})

console.clear()

function particleSpread(entity, colorList, scale = 1) {
    entity.particleRate = 550//粒子生成速率
    entity.particleLifetime = 2//粒子存活时间为2秒
    entity.particleColor = colorList//粒子的颜色列表
    entity.particleSize = [15 * scale, 10 * scale, 5 * scale, 2 * scale, scale]//粒子在5个阶段的大小
    entity.particleSizeSpread = 2 * scale//粒子的大小的随机变化幅度
    entity.particleVelocitySpread = [20 * scale, 20 * scale, 20 * scale]//粒子XYZ方向速度的随机变化幅度
    entity.particleAcceleration = [0, -10 * scale, 0]//粒子往下飘落模拟重力效果
}

const YELLOW = new Box3RGBColor(10, 10, 2)//黄
const CYAN = new Box3RGBColor(2, 10, 10)//青
const MAGENTA = new Box3RGBColor(10, 2, 10)//品红
const RED = new Box3RGBColor(10, 2, 2)//红
const GREEN = new Box3RGBColor(2, 10, 2)//绿
const BLUE = new Box3RGBColor(2, 2, 10)//蓝

//各个颜色5个粒子阶段的颜色列表
const ColorList = [
    [YELLOW, YELLOW, YELLOW, YELLOW, YELLOW],
    [CYAN, CYAN, CYAN, CYAN, CYAN],
    [MAGENTA, MAGENTA, MAGENTA, MAGENTA, MAGENTA],
    [RED, RED, RED, RED, RED],
    [GREEN, GREEN, GREEN, GREEN, GREEN],
    [BLUE, BLUE, BLUE, BLUE, BLUE],
]


function randomColor() {
    return ColorList[Math.floor(ColorList.length * Math.random())] //随机选取一个颜色列表
}

const MeshScale = [1 / 16, 1 / 16, 1 / 16] //默认的模型缩放系数
async function particleShoot(entity) {
    const fireball = world.createEntity({
        bounds: [0, 0, 0], 
        collides: false, 
        gravity: false, // 不受重力影响
        position: entity.position,
    })

    const color = randomColor()//随机颜色
    particleSpread(fireball, color, 0.3) //粒子大小系数缩到0.3, 形成小火球

     // 等待0.1秒后升空
    fireball.velocity.set(0, 1, 0) // 火球速度为每秒向上1格

    await sleep(2000) //升空2秒后爆炸

    fireball.velocity.set(0, 0, 0) // 火球停止运动
    particleSpread(fireball, color, 0.7) // 系数增大到1, 让火球变大

    await sleep(1500) //大火球等待1.5秒后消失
    fireball.destroy()
}
console.clear();
const BEST_PLAYER = ['TQ.喜悦的天狗ao']





world.onPlayerJoin(({ entity }) => {
    if (!Admin.includes(entity.player.name)) return; 
    world.say(`合作者&管喵 ${entity.player.name} 出现了!`);
    
})
world.onPlayerJoin(({ entity }) => {
    if (!BEST_PLAYER.includes(entity.player.name)) return; 
    world.say(`作者&管喵 ${entity.player.name} 出现了!`);
    
})

function cube(vox, sx, sy, sz, xsize, ysize, zsize){
    var xend = sx+xsize
    var yend = sy+ysize
    var zend = sz+zsize
    for(var x=sx;x<xend;x++){
    for(var y=sy;y<yend;y++){
    for(var z=sz;z<zend;z++){
        if(x===sx || z===sx || x===xend-1 || z===zend-1 ){ 
            voxels.setVoxel(x,y,z,vox)
        }
    }}}
}

cube('board_01',0,9,0,255,54,255)  
cube('board_01',0,0,0,255,6,255) 

function cubefill(vox, sx, sy, sz, xsize, ysize, zsize){
    var xend = sx+xsize
    var yend = sy+ysize
    var zend = sz+zsize
    for(var x=sx;x<xend;x++){
    for(var y=sy;y<yend;y++){
    for(var z=sz;z<zend;z++){
        voxels.setVoxel(x,y,z,vox)
    }}}
}

cubefill('glass',1,8,11,254,56,1)   
cubefill('air',127,9,11,4,4,1)


world.onPlayerJoin(({entity}) => {
    entity.player.dialog({
        type: Box3DialogType.TEXT,
        title: "创作团队:",
        content: `你好,${entity.player.name},我们很高兴你来到了这个游戏,来看看教程吧。
        一、基础操作:首先,这个游戏是一个大富翁游戏。因为地方不够,这里就不放规则了。想要看规则的话就去左边的说明牌看吧,右键可以召出菜单哦;
        二、基础介绍:入口的左边走到尽头是控制中心,内有说明牌、告示牌、留言箱、举报箱(作者还弄了三个传送门)从右边的楼梯往下走,楼下是挂机房哦~
        创作团队:${Admin}
        `,
    });
})

for (const e of world.querySelectorAll('*')) {
    if (e.id.startsWith('新年存档')) {
        e.collides = true 
        e.fixed = true 
        e.onEntityContact(({ other }) => { 
            if (other.isPlayer) { 
                if (e.position !== other.player.spawnPoint) { 
                    other.player.directMessage('您已到达新点') 
                    other.player.spawnPoint = e.position 
                }
            }
        })
    }
}

world.onPlayerJoin(({ entity }) => {
    entity.onFluidEnter(() => {
        entity.position.copy(entity.player.spawnPoint)
        entity.position.y += 4
    })
})
world.onPlayerJoin(async({entity}) => {
    if ([Admin].includes(entity.player.name)) {
            entity.jinbi = 喵00
            entity.jinyuanbao = 100000000
            entity.cardList = ['管喵令牌','管喵令牌','管喵令牌','管喵令牌','管喵令牌','管喵令牌','管喵令牌','管喵令牌','管喵令牌','管喵令牌',]
            } else {
            entity.jinbi = 300000
            entity.jinyuanbao = 100
            entity.cardList = ['']
            }
     
})


    

world.onPlayerJoin(async({entity})=>{
    entity.jumpcounttime = 2  
    entity.player.onPress(async({button})=>{
        if(button === Box3ButtonType.ACTION1){

            if ([Admin].includes(entity.player.name)) {
            entity.option2 = ['到大厅','视角切换','观战他人','到玻璃穹顶观战区','到挂机房','到控制中心','到管喵中心']
            } else {
            entity.option2 = ['到大厅','视角切换','观战他人','到玻璃穹顶观战区','到挂机房','到控制中心']
            }
            const result = await entity.player.dialog({
                type: Box3DialogType.SELECT,
                content:`喵oxID: ${entity.player.boxId}\n你的userKey: ${entity.player.userKey}\n你的背包\n金币:${entity.jinbi}\n金元宝:${entity.jinyuanbao}\n卡片:${entity.cardList}`,
                title: '控制面板',
                options: entity.option2,
            })
            if(!result)return;
            switch(result.index){
                case 0:
                    entity.position.set(129,10,7)
                    entity.jumpcounttime = 2
                    break;
                case 1:
                    if(entity.player.cameraMode === 'follow'){
                        entity.player.cameraMode = 'fps';
                    }else{
                        entity.player.cameraMode = 'follow';
                    }
                    break;
                case 2:
                        var players = world.querySelectorAll('player')
                        var names = []
                        for (const i in players) {
                        names.push(players[i].player.name)
                        }
                        const result14 = await entity.player.dialog({
                            type: Box3DialogType.SELECT,
                            lookEye: entity.player.position,
                            content: '请问你要看谁?',
                            options: names,
                        }) 
                        if(!result14 || result14 === null){ 
                            entity.player.directMessage('取消交互');
                            entity.player.disableInputDirection=BOx3InputDirection.BOTH;
                        }
                        world.querySelectorAll('player').forEach((x) => {
                            if(x.player.name == result14.value){
                                x.player.directMessage(`${entity.player.name}正在看你...................`)
                                entity.player.cameraEntity = x;
                            }
                        }); 
                    break;
                case 3:
                    entity.position.set(128,喵,128)
                    entity.jumpcounttime = 2
                    break;
                case 4:
                    entity.position.set(21,3,19)
                    entity.jumpcounttime = 2
                    break; 
                case 5:
                    entity.position.set(241,10,5)
                    entity.jumpcounttime = 2
                    break;
                case 6:
                    entity.position.set(128,54,128)
                    entity.jumpcounttime = 2
                    break;
                        
            }
            
        }
    })
})
var admin = ['TQ.喜悦的天狗ao','TDS尹子','海默喵_肖恩','天无灵应','一只正在诈尸的创作喵yee)','绝对-代码喵(全能岛民)','天无灵应','仙.鹤/号丢了/136','TQ.打豆豆','卢娜洛夫古德','庄轩睿','计算机鬼谷八荒','SWA机灵的飞电鼠3FI0']
world.onChat(l=>l.message=="重启"?db.sql([""], ""):0);
world.onChat(({ entity, message }) => {
    if (entity.isPlayer) {
        if (message == '还原') {
            entity.player.scale = 1
            entity.player.runSpeed = 1
            entity.player.invisible = false
            entity.player.spectator = false
            entity.player.color.set(1, 1, 1)
            entity.player.canFly = false
            entity.player.showName = true
            entity.player.emissive = 0
            entity.player.shininess = 0;
            entity.hp= 100
        }
        if (admin.includes(entity.player.name)) {
            if(message.startsWith('禁言')){
                if(message.slice(2)==entity.player.name){
                    entity.player.directMessage('无法禁言自己,请重新尝试!')
                }else{
                    world.querySelectorAll('player').forEach((x)=>{
                        if(x.player.name == message.slice(2)){
                            x.player.directMessage('你已被管喵禁言,请等待管喵解除')
                            world.say('有人犯了错,被管喵禁言了!')
                            x.player.muted=true
                        }
                    })
                }
            }
            if(message.startsWith('解除禁言')){
                if(message.slice(4)==entity.player.name){
                    entity.player.directMessage('无法解除禁言自己,请重新尝试!')
                }else{
                    world.querySelectorAll('player').forEach((x)=>{
                        if(x.player.name == message.slice(4)){
                            x.player.directMessage('你已被管喵解除禁言')
                            world.say('有人被管喵解除禁言了!')
                            x.player.muted=false
                        }
                    })
                }
            }
            if(message.startsWith('踢出')){
                if(message.slice(3)==entity.player.name){
                    entity.player.directMessage('无法踢出自己,请重新尝试!')
                }else if(admin.includes(message.slice(3))){
                    entity.player.directMessage('无法踢出管喵!')
                }else {
                    world.querySelectorAll('player').forEach((x)=>{
                        if(x.player.name == message.slice(3)){
                            world.say(`${x.player.name} 被管喵踢出了!`)
                            x.player.kick()
                        }
                    })
                }
            }
            if (message == '变大') { entity.player.scale += 5; world.say(entity.player.name + '管喵变大了') }
            if (message == '变小') { entity.player.scale += -5; world.say(entity.player.name + '管喵变小了') }
            if (message == '还原大小') { entity.player.scale = 1; world.say(entity.player.name + '管喵还原了大小') }
            if (message == '飞行') { entity.player.canFly = true; world.say(entity.player.name + '管喵开启了飞行模式') }
            if (message == '解除飞行') { entity.player.canFly = false; world.say(entity.player.name + '管喵关闭了飞行模式') }
            
            if (message == '加速') {
                entity.player.walkSpeed += 50
                entity.player.runSpeed += 50
                entity.player.flySpeed += 50
                world.say(entity.player.name + '管喵加速了')
            }
            if (message == '隐身') { entity.player.invisible = true; world.say(entity.player.name + '管喵隐身了') }
            if (message == '现身') { entity.player.invisible = false; world.say(entity.player.name + '管喵现身了') }
            if (message == '隐藏名字') { entity.player.showName = false; world.say(entity.player.name + '管喵隐藏了名字') }
            }
            if (message == '完全隐身') { entity.player.invisible = true; entity.player.showName = false; world.say(entity.player.name + '管喵完全隐身了') }
            if (message == '显示名字') { entity.player.showName = true; world.say(entity.player.name + '管喵显示了名字') }
            if (message == '幽灵') { entity.player.spectator = true; world.say(entity.player.name + '管喵开启了幽灵模式') }
            if (message == '解除幽灵') { entity.player.spectator = false; world.say(entity.player.name + '管喵关闭了幽灵模式') }
            if (message == '发光') { entity.player.emissive = 1; world.say(entity.player.name + '管喵开启了发光效果') }
            if (message == '还原发光') { entity.player.emissive = 0; world.say(entity.player.name + '还原了发光效果') }
            if (message == '反光') { entity.player.shininess = 1; world.say(entity.player.name + '管喵开启了反光效果') }
            if (message == '还原反光') { entity.player.shininess = 0; world.say(entity.player.name + '管喵还原了反光效果') }
            if (message == '变红色') { entity.player.color.set(1, 0, 0); world.say(entity.player.name + '管喵变成了红色') }
            if (message == '变蓝色') { entity.player.color.set(0, 0, 1); world.say(entity.player.name + '管喵变成了蓝色') }
            if (message == '变绿色') { entity.player.color.set(0, 1, 0); world.say(entity.player.name + '管喵变成了绿色') }
            if (message == '变紫色') { entity.player.color.set(1, 0, 1); world.say(entity.player.name + '管喵变成了紫色') }
            if (message == '变黄色') { entity.player.color.set(1, 1, 0); world.say(entity.player.name + '管喵变成了黄色') }
            
            if (message == '变浅蓝色') { entity.player.color.set(0, 1, 1); world.say(entity.player.name + '管喵变成了浅蓝色') }
            if (message == '还原颜色') { entity.player.color.set(1, 1, 1); world.say(entity.player.name + '管喵还原了颜色') }
            if (message == '瞬移') { shunyi = 1; world.say(entity.player.name + '管喵开启了瞬移') }
            if (message == '关闭瞬移') { shunyi = 0; world.say(entity.player.name + '管喵关闭了瞬移')  }
            if (message == '全部还原') {
                entity.player.canFly = false
                entity.player.showName = true;
                entity.player.spectator = false;
                entity.player.invisible = false;
                entity.player.emissive = 0;
                entity.player.shininess = 0;
                entity.player.color.set(1, 1, 1);
                Object.assign(entity, { particleRate: 250, });
                world.say(entity.player.name + '管喵全部还原了');
            };
         if (message == '关闭粒子特效') { Object.assign(entity, { particleRate: 0, }); world.say(entity.player.name + '关闭了粒子特效');}
         if (message == '开启粒子特效') { Object.assign(entity, { particleRate: 1000, }); world.say(entity.player.name + '开启了粒子特效');}
        
    }
})
world.onChat(({ entity, message }) => {
    if (message === '申请管喵') {
        entity.player.directMessage('已申请')
        test_player.onPlayerJoin(({ entity }) => {  
            entity.player.directMessage('已申请')
        })
    } 
})

/*举报箱代码*/

db.sql`CREATE TABLE IF NOT EXISTS "report"(
    "title" TEXT NOT NULL
)`
world.querySelectorAll('#举报箱').forEach(async (e) => {
    e.enableInteract = true
    e.interactHint = '举报箱'
    e.interactRadius = 3;
    e.onInteract(async ({ entity }) => {
        if (['TQ.喜悦的天狗ao','机智的飞电鼠3FI0','创作喵.名字被抢了','天无灵应','dhdhdhkdh','追光者喵','Ozer','仙.鹤/号丢了/136','3730','xuan.疾风魔影','名探酱','计算机鬼谷八荒','伴雪纷飞','yee剑走天下','Threadripper','小飞机呀','天狗ao很喜悦'].includes(entity.player.name)) {
            entity.option = ['举报' ,'审核举报']
        } else {
            entity.option = ['举报']
        }
        const result_1 = await entity.player.dialog({
            type: Box3DialogType.SELECT,
            title: "意见箱",
            content: `此箱为举报箱`,
            options: entity.option,
        });
        //如果玩家点击了屏幕其他区域,取消对话框
        if (!result_1 || result_1 === null) {
            return;
        }
        //判断玩家选了什么选项
        switch (result_1.value) {
            case '举报':
                const 喵1 = await input(entity, '举报箱', '请填写玩家名', '确定', '请勿恶意举报,否则会受到惩罚')
                const 喵2 = await select(entity, '举报箱', '请选择举报人物类型', ['管喵', '玩家'])
                if (!喵2 || 喵2 === null) return
                const 喵3 = await input(entity, '举报箱', `请填写${喵2.value} ${喵1}的举报理由`, '确定', '请勿乱写理由,否则会受到惩罚')
                if (喵1 != null && 喵2 != null && 喵3 != null) {
                    if (喵3.length <= 50 && 喵1.length <= 15) {
                        const 喵 = `${entity.player.name}的举报
                    -举报类型:${喵2.value}
                    -举报理由:${喵3}
                    -举报玩家:${喵1} `
                        try {
                            db.sql`INSERT INTO "report" VALUES(${喵})`;//插入新字段
                            entity.player.dialog({
                                type: Box3DialogType.TEXT,
                                title: '举报箱',
                                content: `${喵}\n举报成功,等待管喵审核`,
                            })
                        } catch (e) {
                            entity.player.dialog({
                                type: Box3DialogType.TEXT,
                                title: '错误',
                                content: '举报失败 :( \n' + e,
                            })
                        }
                    } else {
                        entity.player.dialog({
                            type: Box3DialogType.TEXT,
                            title: '举报箱',
                            content: '举报字数不能超过50个字哦~名字也是哦',
                        })
                    }
                }
                break
            
            case '审核举报':
                let num = 0
                while (true) {
                    const rows = await db.sql`SELECT * FROM "report"`;
                    let title = [];
                    for (let i in rows) {
                        title.push(rows[i].player);
                    }
                    if (num + 1 > title.length) {
                        num = 0
                    }
                    if (title.length == 0) {
                        await text(entity, '举报箱内容已空', '举报箱内内容已空')
                        return
                    }
                    const result = await select(entity, '举报箱', `第${num + 1}/${title.length}项\n${title[num]}`, ['查看上一项', '查看下一项', '删除内容', '封号', '禁言'])
                    if (result) {
                        if (result.value == '查看下一项') {
                            if (num + 1 < title.length) {
                                num += 1
                            } else {
                                await text(entity, '友情提示', '已经到底')
                            }
                            continue;
                        } else if (result.value == '查看上一项') {
                            if (num > 0) {
                                num -= 1
                            } else {
                                await text(entity, '友情提示', '现在是第一项')
                            }
                            continue;

                        } else if (result.value == '删除内容') {
                            try {
                                await db.sql`DELETE FROM report WHERE player = ${title[num]}`
                                await text(entity, '删除成功', `第${num + 1}/${title.length}项\n${title[num]}\n该内容删除成功!`)

                            } catch (e) {
                                await text(entity, '删除失败', e)
                            }
                            continue;
                        } else if (result.value == '封号') {
                            const feng = title[num]
                            for (let i in feng.split(':')) {
                                console.log('封禁 ' + i + ':' + feng.split(':')[i])
                            }
                        }
                    } else {
                        return
                    }
                }
            default:
            
        }
    })
})

//

for (const npc of world.querySelectorAll('.NPC')) {
    npc.enableInteract = true 
    npc.interactRadius = 4.5 
    npc.interactHint = npc.id 
    if(npc.id == '招人海报'){
        npc.onInteract(async({entity}) => {
        const result = await entity.player.dialog({
                    type: Box3DialogType.SELECT,
                    title: "招人海报",
                    content: `亲爱的玩家${entity.player.name},你好!
                    这是作者的招人海报,下面是招人海报内容:
                    作者找管喵,有意者进 https://box3.codemao.cn/e/8df2579f48fff1aa90b7
                    `,
                    
                    
                });    
        })
        
        
    }
    if(npc.id == '黑名单'){
        npc.onInteract(async({entity}) => {
        const result = await entity.player.dialog({
                    type: Box3DialogType.SELECT,
                    title: "黑名单",
                    content: `亲爱的玩家${entity.player.name},你好!
                    这是作者大大的黑名单,下面是黑名单内容(包括昵称、boxID):\n
                    `,
                    options:BAN
                    
                });    
        })
    }
    if(npc.id == '留言箱'){
        npc.onInteract(async({entity}) => {
            let options = ['提意见']
            if(admin.includes(enttity.player.name)){
                options.push('查看意见')
                if(entity.player.name === 'TG.喜悦的天狗ao'){
                    options.push('删除所有意见')
                }
            }
            const result = await entity.player.dialog({
                type: Box3DialogType.SELECT,
                title: `留言箱`,
                content: '请选择需要什么:',
                options: options,
            })
            if (!result || result === null) {
                return '关闭';
            }
            if (result.index == 0) {
                //entity.hurt(1)
                const result = await entity.player.dialog({
                    type: Box3DialogType.INPUT,
                    title: "系统",
                    titleTextColor: new Box3RGBAColor(1, 1, 1, 1),
                    titleBackgroundColor: new Box3RGBAColor(0, 0, 0, 0.98),
                    content: `亲爱的玩家${entity.player.name},你有什么建议呢?\n(悄悄告诉你,如果你提了特别好的建议,会获得管喵身份哦~)`,
                    confirmText: '确定', // 确定按钮上面的文字。按下确定按钮后,提交回答。
                    placeholder: '输入你的建议', // 输入框背景上的提示文字。
                    contentTextColor: new Box3RGBAColor(1, 1, 1, 1),
                    contentBackgroundColor: new Box3RGBAColor(0, 0, 0, 0.5),
                    lookTarget: entity,
                });
                if (!result || result === null) {
                    return '关闭';
                } else {
                    entity.player.dialog({
                        type: Box3DialogType.TEXT,
                        title: '提示',
                        content: '提交成功,SQL上传成功!'
                    })
                }
            }
            if (result.index == 1) {
                if (admin.includes(entity.player.name)) {
                } else {
                    entity.player.dialog({
                        type: Box3DialogType.TEXT,
                        title: "系统",
                        content: `
                        你不是管喵哦!`,
                    })
                }
            } if (result.index == 2) {
                if (admin.includes(entity.player.name)) {
                    entity.player.dialog({
                        type: Box3DialogType.TEXT,
                        title: "系统",
                        content: '意见箱已清空!',
                    })
                } else {
                    entity.player.dialog({
                        type: Box3DialogType.TEXT,
                        title: "系统",
                        content: `
                        你不是作者哦!`,
                    })
                }
            }
        })
    }
    if(npc.id == '告示牌'){
        npc.onInteract(async({entity}) => {
        const result = await entity.player.dialog({
                    type: Box3DialogType.TEXT,
                    title: "告示牌",
                    content: `亲爱的玩家${entity.player.name},你好!
                    这是作者大大的告示牌,他有新的动向、新的活动都会在这里发布。(最新的消息在最下面)下面是告示内容:\n
                    2023/01/09:作者(TQ.喜悦的天狗ao)更新了最新管喵名单,一共9人:“TQ.喜悦的天狗ao、天无灵应、dhdhdhkdh、追光者喵、仙.鹤/号丢了/136、Ozer、3730、xuan.疾风魔影、名探酱”。
                    2023/01/10:作者(TQ.喜悦的天狗ao)更新了最新管喵名单,一共10人:“TQ.喜悦的天狗ao、天无灵应、dhdhdhkdh、追光者喵、仙.鹤/号丢了/136、Ozer、3730、xuan.疾风魔影、名探酱、计算机鬼谷八荒”。
                    2023/01/11:作者(TQ.喜悦的天狗ao)更新了最新管喵名单,一共16人:“TQ.喜悦的天狗ao、创作喵.名字被抢了、天无灵应、dhdhdhkdh、追光者喵、仙.鹤/号丢了/136、Ozer、3730、xuan.疾风魔影、名探酱、计算机鬼谷八荒、伴雪纷飞、yee剑走天下、Threadripper、小飞机呀、天狗ao很喜悦”。
                    `,
                    
                });    
        })
    }
    if(npc.id == '选项式监控'){
        const FK = world.querySelector('#贺年的ww酱-1');
    const zhiyin = world.querySelector('#神奇代码岛-1');
    const jk = world.querySelector('#选项式监控');//找到模型
    jk.onInteract(async({ entity }) => {
    const d = await entity.player.dialog({
        type: Box3DialogType.SELECT,//SELECT选择样式对话框
        title: '选项式监控',
        titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
        titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1),
        options: ['1号', '2号'],   // 将提供玩家选择的选项放入数组里。
        content: '你要监控几号?',
    })
    if (d) {//如果选择
        const { index } = d;//解构赋值
        if (index === 0) {//第一项
            world.say(`管喵${entity.player.name}正在使用1号监控`)
               entity.player.dialog({
             type: Box3DialogType.TEXT,
             title: '选项式监控',
             lookEye: world.querySelector('#新年少女-1'),             // 将相机放在玩家位置
             lookTarget: FK,             //npc可以改
             content:'监控中...',
            });  
        }
    }
    if (d) {//如果选择
        const { index } = d;//解构赋值
        if (index === 1) {//第一项
            world.say(`管喵${entity.player.name}正在使用2号监控`)
               entity.player.dialog({
             type: Box3DialogType.TEXT,
             title: '选项式监控',
             lookEye: world.querySelector('#新年女孩-2'),             // 将相机放在玩家位置
             lookTarget: zhiyin,             //npc可以改
             content:'监控中...',
            });  
        }
    }
});
        
    }

    if(npc.id == 'TQ.喜悦的天狗ao的A喵'){
        npc.onInteract(async({entity}) => {
            const selection = await entity.player.dialog({
                type: Box3DialogType.SELECT, //对话框类型为选择框
                content: `你有${entity.jinbi}个金币、${entity.jinyuanbao}个金元宝,想做什么呢?`,
                title: npc.id, //对话框左上角显示NPC名字
                options: ['100金币换1金元宝','1金元宝换100金币'], //选项
            })
            if(!selection||selection === null){return};
            switch(selection.index){
                case 0:
                    if(entity.jinbi != 0 || entity.jinbi > 100){
                        entity.jinyuanbao = entity.jinyuanbao + 1
                        entity.jinbi = entity.jinbi - 100
                        entity.player.directMessage('交易成功!')
                    }else if(entity.jinbi = 0 || entity.jinbi<100){
                        entity.player.directMessage('金币不够!')
                    }
                    break;
                case 1:
                    if(entity.jinyuanbao != 0){
                        entity.jinyuanbao = entity.jinyuanbao - 1
                        entity.jinbi = entity.jinbi + 100
                        entity.player.directMessage('交易成功!')
                    }else if(entity.jinyuanbao < 1){
                        entity.player.directMessage('金元宝不够!')
                    }
                    break;
                
                      
            }
        })
    }
    if(npc.id == 'TQ.喜悦的天狗ao的分身'){
        npc.onInteract(async({entity}) => {
            const result = await entity.player.dialog({
                type: Box3DialogType.SELECT,
                title: npc.id,
                content: '我是作者的分身,请选择你需要什么:',
                options: ['提意见', '查看意见(仅作者)', '删除所有意见(仅作者)'],
            })
            if (!result || result === null) {
                return '关闭';
            }
            if (result.index == 0) {
                //entity.hurt(1)
                const result = await entity.player.dialog({
                    type: Box3DialogType.INPUT,
                    title: "系统",
                    titleTextColor: new Box3RGBAColor(1, 1, 1, 1),
                    titleBackgroundColor: new Box3RGBAColor(0, 0, 0, 0.98),
                    content: `亲爱的玩家${entity.player.name},你有什么建议呢?\n(悄悄告诉你,如果你提了特别好的建议,会获得管喵身份哦~)`,
                    confirmText: '确定', // 确定按钮上面的文字。按下确定按钮后,提交回答。
                    placeholder: '输入你的建议', // 输入框背景上的提示文字。
                    contentTextColor: new Box3RGBAColor(1, 1, 1, 1),
                    contentBackgroundColor: new Box3RGBAColor(0, 0, 0, 0.5),
                    lookTarget: entity,
                });
                if (!result || result === null) {
                    return '关闭';
                } else {
                    entity.player.dialog({
                        type: Box3DialogType.TEXT,
                        title: '提示',
                        content: '提交成功,SQL上传成功!'
                    })
                }
            }
            if (result.index == 1) {
                if (admin.includes(entity.player.name)) {
                } else {
                    entity.player.dialog({
                        type: Box3DialogType.TEXT,
                        title: "系统",
                        content: `
                        你不是作者哦!`,
                    })
                }
            } if (result.index == 2) {
                if (admin.includes(entity.player.name)) {
                    entity.player.dialog({
                        type: Box3DialogType.TEXT,
                        title: "系统",
                        content: '意见箱已清空!',
                    })
                } else {
                    entity.player.dialog({
                        type: Box3DialogType.TEXT,
                        title: "系统",
                        content: `
                        你不是作者哦!`,
                    })
                }
            }
        })
    }
    if(npc.id == '说明牌'){
        npc.onInteract(async({entity}) => {
        const result = await entity.player.dialog({
                    type: Box3DialogType.TEXT,
                    title: "说明牌",
                    content: `亲爱的玩家${entity.player.name},你好!这是作者大大的说明牌。
                    这个说明牌可以教会你怎么玩游戏“争做大富翁”、告诉你创作者的组织概况、以及带你领取亿点点小福利……\n
                    一、"争做大富翁"游戏规则如下:
                    1、游戏开始
                    每位玩家有300000元作为资产;每位管喵有喵00元、100000000个元宝及10张卡片作为资产。
                    2、掷骰
                    每次同时掷出两颗骰*,两颗骰*的点数相同的话可以多一个回合。
                    3、地产
                    玩家到达无人拥有的地皮,玩家可选择要不要购买。银行的钱是无限的,但建筑物的高度及过路费的最大值是有限的。
                    4、套取现金
                    在任何时候,玩家可以半价把房子或地皮卖给银行,也可在任何时候赎回地皮。赎地时要加付抵押值10%的利息。
                    5、交易
                    在任何时间,玩家可与对手交易没有建筑物的地皮,先商谈的交易先处理。玩家间不得借贷。
                    8、破产
                    如在卖出或抵押所有资产后仍无足够的现金以支付债务,则玩家宣告破产。所有资产直接转让给银行。
                    9、胜利条件
                    最后一位没有破产的玩家得胜。限时结束时,总资产最高者得胜。

                    二、创作人员组织概况:
                    1、作者:TQ.喜悦的天狗ao;
                    2、建筑+模型师:TQ.喜悦的天狗ao、天无灵应、计算机鬼谷八荒、仙.鹤/号丢了/136、伴雪纷飞、yee剑走天下、Threadripper、小飞机呀、天狗ao很喜悦;
                    3、代码师:dhdhdhkdh、Ozer、创作喵.名字被抢了、xuan.疾风魔影、名探酱、追光者喵、天无灵应、3730、TQ.喜悦的天狗ao;
                    4、仍在招人中……:有意愿的同志星期一到星期五中午12点到下午5点可以找到作者。
                    (〃'▽'〃) 
                    
                    `,
                    
                });    
        })
    }
    
        
        
}
    
var zuozhe = ['TQ.喜悦的天狗ao','czm']//这里填入你的玩家名字、识别码或者ID
world.onChat(async ({ entity, message }) => {
    if (zuozhe.includes(entity.player.name)) {
        if (message[0] == "$") {
            if (zuozhe.includes(entity.player.name)||zuozhe.includes(entity.player.boxId)||zuozhe.includes(entity.player.userKey)) {
                try {
                    var code = eval(message.slice(1));
                    world.say(`~>${code}`)
                }
                catch (e) {
                    world.say(e)
                }
            }
        }
    }
})

var door1 = world.querySelector('#出狱1')  //名称需与模型的名称保持一致
door1.enableInteract = true
door1.interactRadius = 2.5

var door2 = world.querySelector('#出狱2')  //名称需与模型的名称保持一致
door2.enableInteract = true
door2.interactRadius = 2.5

door1.onInteract(({ entity }) => {
    entity.position.copy(door2.position)
})

door2.onInteract(({ entity }) => {
    entity.position.copy(door1.position)
})
var door3 = world.querySelector('#3')  //名称需与模型的名称保持一致
door3.enableInteract = true
door3.interactRadius = 2.5

var door4 = world.querySelector('#4')  //名称需与模型的名称保持一致
door4.enableInteract = true
door4.interactRadius = 2.5

door3.onInteract(({ entity }) => {
    entity.position.copy(door4.position)
})

door4.onInteract(({ entity }) => {
    entity.position.copy(door3.position)
})
// 添加检测玩家进入或离开 x:0-喵, y:0-20, z: 0-喵 的区域
const area = world.addTrigger({
    selector: 'player',
    bounds: {
        lo: [127, 7, 79],
        hi: [136, 14, 93],
    },
})

// 有玩家进入区域
area.onEnter(({ entity }) => {
    world.say(`玩家${entity.player.name}犯了法并进了监狱`)
})

// 有玩家离开区域
area.onLeave(({ entity }) => {
    world.say(`玩家${entity.player.name}越了狱`)
})
const area5 = world.addTrigger({
    selector: 'player',
    bounds: {
        lo: [177, 7, 69],
        hi: [191, 14, 88],
    },
})

// 有玩家进入区域
area5.onEnter(({ entity }) => {
    world.say(`玩家${entity.player.name}被打成喵,进了医院。`)
})

// 有玩家离开区域
area5.onLeave(({ entity }) => {
    world.say(`玩家${entity.player.name}被治愈了,离开了医院。`)
})
const area6 = world.addTrigger({
    selector: 'player',
    bounds: {
        lo: [17,1,18],
        hi: [25,5,28],
    },
})

// 有玩家进入区域
area6.onEnter(({ entity }) => {
    world.say(`玩家${entity.player.name},进了挂机房`)
})

// 有玩家离开区域
area6.onLeave(({ entity }) => {
    world.say(`玩家${entity.player.name},离开了挂机房`)
})
const area7 = world.addTrigger({
    selector: 'player',
    bounds: {
        lo: [123,53,123],
        hi: [132,61,132],
    },
})

// 有玩家进入区域
area7.onEnter(({ entity }) => {
    world.say(`管喵${entity.player.name},进入了管喵中心`)
})

// 有玩家离开区域
area7.onLeave(({ entity }) => {
    world.say(`管喵${entity.player.name},离开了管喵中心`)
})
const area8 = world.addTrigger({
    selector: 'player',
    bounds: {
        lo: [6,8,17],
        hi: [248,20,248],
    },
})

// 有玩家进入区域
area8.onEnter(({ entity }) => {
    world.say(`玩家${entity.player.name},进入了游戏区`)
})

// 有玩家离开区域
area8.onLeave(({ entity }) => {
    world.say(`玩家${entity.player.name},离开了游戏区`)
})
world.onPlayerJoin(async({ entity }) => {
    entity.player.message1 = "E";
    entity.player.interactTimes = 0;
    entity.enableInteract = true;
    entity.interactRadius = 3
    entity.interactHint = '和  ' + entity.player.name + "  私聊";
    entity.onInteract(async ({ entity, targetEntity }) => {
        const result = await entity.player.dialog({
            type: Box3DialogType.SELECT,
            title: targetEntity.player.name,
            content: `和   ${targetEntity.player.name}  私聊`,
            options: ['和TA私聊','退出互动','还没做好'], 
        })
        if (!result || result === null) {
            entity.player.directMessage('你取消了互动!');
            return;
        }
        if (result.index == 0) {
            const dialog = await entity.player.dialog({
                type: Box3DialogType.INPUT,
                title: "向 "+targetEntity.player.name+" 发送私聊",
                content: `${entity.player.name},请输入私聊的内容`,
                confirmText: '发送', 
                placeholder: '请输入私聊内容', 
            });
            targetEntity.player.message1 = dialog;
            targetEntity.player.directMessage(+entity.player.name+' 向你发送了私聊,请打开以查看')
            await sleep(2000);
            targetEntity.player.directMessage(+entity.player.name+" 发来了私聊!")
            entity.player.directMessage('对方收到了!')
            if (dialog) {
                const dialog = targetEntity.player.dialog({
                    type: Box3DialogType.TEXT,
                    title: entity.player.name, 
                    content: targetEntity.player.message1,
                });
            }
        }
    })
})


var door5 = world.querySelector('#传送门->混沌神域[2区]')  

door5.enableInteract = true
door5.interactRadius = 2.5

door5.onInteract(({ entity }) => {
    entity.player.link('https://box3.codemao.cn/p/hundunsy2')     
    
})
var door6 = world.querySelector('#传送门->梗明星大乱斗[春节]')  

door6.enableInteract = true
door6.interactRadius = 2.5

door6.onInteract(({ entity }) => {
    entity.player.link('https://box3.codemao.cn/p/memes')     
    
})
console.clear();
// 请勿删除这一行
world.onChat(({ entity, message }) => {
    if (entity&&entity.isPlayer) {
        if(entity&&Admin.indexOf(entity.player.name)!=-1&&message.charAt(0)=='$'){
        try{
        world.say('<~ '+eval(message.split('$')[1]))}catch(err){
            world.say('Error:'+err)
        }
    };
    }
})

var door7 = world.querySelector('#7')  //名称需与模型的名称保持一致
door7.enableInteract = true
door7.interactRadius = 2.5

var door8 = world.querySelector('#8')  //名称需与模型的名称保持一致
door8.enableInteract = true
door8.interactRadius = 2.5

door7.onInteract(({ entity }) => {
    entity.position.copy(door8.position)
})

door8.onInteract(({ entity }) => {
    entity.position.copy(door7.position)
})


回复

上一页1 页 / 共 1下一页
_function_h_function_h

不错emotion_编程猫_加油

点赞0


评论