xy-server/game/object/WorldStarMgr.ts
2025-04-23 09:34:08 +08:00

540 lines
25 KiB
TypeScript

import WorldStar from "./WorldStar";
import NpcMgr from "../core/NpcMgr";
import PlayerMgr from "./PlayerMgr";
import GTimer from "../common/GTimer";
import SKDataUtil from "../gear/SKDataUtil";
import Currency from "../activity/Currency";
export default class WorldStarMgr {
vecStar: any[];
variationList: any[];
variationSkyStar: any[];
refresh_timer: any;
constructor() {
this.vecStar = [];
this.variationList = [];
this.variationSkyStar = [];
this.init();
this.refresh_timer = 0;
}
init() {
//地狗星-大唐边境
this.vecStar.push(new WorldStar(30168, 1007, 1, 1));
this.vecStar.push(new WorldStar(30169, 1007, 1, 1));
this.vecStar.push(new WorldStar(30170, 1007, 1, 1));
this.vecStar.push(new WorldStar(30169, 1007, 1, 1));
this.vecStar.push(new WorldStar(30170, 1007, 1, 1));
this.vecStar.push(new WorldStar(30169, 1007, 1, 1));
this.vecStar.push(new WorldStar(30170, 1007, 1, 1));
this.vecStar.push(new WorldStar(30169, 1007, 1, 1));
this.vecStar.push(new WorldStar(30170, 1007, 1, 1));
//地平星-方寸山
this.vecStar.push(new WorldStar(30171, 1005, 2, 1));
this.vecStar.push(new WorldStar(30172, 1005, 2, 1));
this.vecStar.push(new WorldStar(30173, 1005, 2, 1));
this.vecStar.push(new WorldStar(30172, 1005, 2, 1));
this.vecStar.push(new WorldStar(30173, 1005, 2, 1));
this.vecStar.push(new WorldStar(30172, 1005, 2, 1));
this.vecStar.push(new WorldStar(30173, 1005, 2, 1));
this.vecStar.push(new WorldStar(30172, 1005, 2, 1));
this.vecStar.push(new WorldStar(30173, 1005, 2, 1));
//地悠星-普陀山
this.vecStar.push(new WorldStar(30174, 1001, 3, 1));
this.vecStar.push(new WorldStar(30175, 1001, 3, 1));
this.vecStar.push(new WorldStar(30176, 1001, 3, 1));
this.vecStar.push(new WorldStar(30175, 1001, 3, 1));
this.vecStar.push(new WorldStar(30176, 1001, 3, 1));
this.vecStar.push(new WorldStar(30175, 1001, 3, 1));
this.vecStar.push(new WorldStar(30176, 1001, 3, 1));
this.vecStar.push(new WorldStar(30175, 1001, 3, 1));
this.vecStar.push(new WorldStar(30176, 1001, 3, 1));
//地异星-地府
this.vecStar.push(new WorldStar(30177, 1002, 4, 1));
this.vecStar.push(new WorldStar(30178, 1002, 4, 1));
this.vecStar.push(new WorldStar(30179, 1002, 4, 1));
this.vecStar.push(new WorldStar(30178, 1002, 4, 1));
this.vecStar.push(new WorldStar(30179, 1002, 4, 1));
//地微星-大唐境内
this.vecStar.push(new WorldStar(30180, 1004, 5, 1));
this.vecStar.push(new WorldStar(30181, 1004, 5, 1));
this.vecStar.push(new WorldStar(30182, 1004, 5, 1));
this.vecStar.push(new WorldStar(30181, 1004, 5, 1));
this.vecStar.push(new WorldStar(30182, 1004, 5, 1));
//地奇星-天宫
this.vecStar.push(new WorldStar(30183, 1012, 6, 1));
this.vecStar.push(new WorldStar(30184, 1012, 6, 1));
this.vecStar.push(new WorldStar(30184, 1012, 6, 1));
this.vecStar.push(new WorldStar(30184, 1012, 6, 1));
this.vecStar.push(new WorldStar(30184, 1012, 6, 1));
//地查星-天宫
this.vecStar.push(new WorldStar(30186, 1012, 7, 1));
this.vecStar.push(new WorldStar(30187, 1012, 7, 1));
this.vecStar.push(new WorldStar(30188, 1012, 7, 1));
this.vecStar.push(new WorldStar(30187, 1012, 7, 1));
this.vecStar.push(new WorldStar(30188, 1012, 7, 1));
//地稽星-东海渔村
this.vecStar.push(new WorldStar(30189, 1010, 8, 1));
this.vecStar.push(new WorldStar(30190, 1010, 8, 1));
this.vecStar.push(new WorldStar(30191, 1010, 8, 1));
this.vecStar.push(new WorldStar(30190, 1010, 8, 1));
this.vecStar.push(new WorldStar(30191, 1010, 8, 1));
//地慧星-长安
this.vecStar.push(new WorldStar(30192, 1011, 9, 1));
this.vecStar.push(new WorldStar(30193, 1011, 9, 1));
this.vecStar.push(new WorldStar(30194, 1011, 9, 1));
this.vecStar.push(new WorldStar(30193, 1011, 9, 1));
this.vecStar.push(new WorldStar(30194, 1011, 9, 1));
//地魁星-大唐境内
this.vecStar.push(new WorldStar(30195, 1004, 10, 1));
this.vecStar.push(new WorldStar(30196, 1004, 10, 1));
this.vecStar.push(new WorldStar(30197, 1004, 10, 1));
this.vecStar.push(new WorldStar(30196, 1004, 10, 1));
this.vecStar.push(new WorldStar(30197, 1004, 10, 1));
//地灵星-方寸山
this.vecStar.push(new WorldStar(30198, 1005, 11, 1));
this.vecStar.push(new WorldStar(30199, 1005, 11, 1));
this.vecStar.push(new WorldStar(30200, 1005, 11, 1));
this.vecStar.push(new WorldStar(30199, 1005, 11, 1));
this.vecStar.push(new WorldStar(30200, 1005, 11, 1));
//地隐星-普陀山
this.vecStar.push(new WorldStar(30201, 1001, 12, 1));
this.vecStar.push(new WorldStar(30202, 1001, 12, 1));
this.vecStar.push(new WorldStar(30203, 1001, 12, 1));
this.vecStar.push(new WorldStar(30202, 1001, 12, 1));
this.vecStar.push(new WorldStar(30203, 1001, 12, 1));
this.vecStar.push(new WorldStar(30203, 1001, 12, 1));
this.vecStar.push(new WorldStar(30203, 1001, 12, 1));
this.vecStar.push(new WorldStar(30203, 1001, 12, 1));
this.vecStar.push(new WorldStar(30203, 1001, 12, 1));
//地佑星-白骨山
this.vecStar.push(new WorldStar(70001, 1008, 13, 1));
this.vecStar.push(new WorldStar(70001, 1008, 13, 1));
this.vecStar.push(new WorldStar(70001, 1008, 13, 1));
this.vecStar.push(new WorldStar(70001, 1008, 13, 1));
this.vecStar.push(new WorldStar(70001, 1008, 13, 1));
this.vecStar.push(new WorldStar(70001, 1008, 13, 1));
this.vecStar.push(new WorldStar(70001, 1008, 13, 1));
this.vecStar.push(new WorldStar(70001, 1008, 13, 1));
this.vecStar.push(new WorldStar(70001, 1008, 13, 1));
//地文星-白骨山
this.vecStar.push(new WorldStar(81001, 1008, 14, 1));
this.vecStar.push(new WorldStar(81002, 1008, 14, 1));
this.vecStar.push(new WorldStar(81003, 1008, 14, 1));
this.vecStar.push(new WorldStar(81001, 1008, 14, 1));
this.vecStar.push(new WorldStar(81002, 1008, 14, 1));
//地煞星-龙宫
this.vecStar.push(new WorldStar(81004, 1009, 15, 1));
this.vecStar.push(new WorldStar(81005, 1009, 15, 1));
this.vecStar.push(new WorldStar(81006, 1009, 15, 1));
this.vecStar.push(new WorldStar(81004, 1009, 15, 1));
this.vecStar.push(new WorldStar(81005, 1009, 15, 1));
//地雄星-龙宫
this.vecStar.push(new WorldStar(81007, 1009, 16, 1));
this.vecStar.push(new WorldStar(81008, 1009, 16, 1));
this.vecStar.push(new WorldStar(81009, 1009, 16, 1));
this.vecStar.push(new WorldStar(81007, 1009, 16, 1));
//地杰星-兰若寺
this.vecStar.push(new WorldStar(81010, 1013, 17, 1));
this.vecStar.push(new WorldStar(81011, 1013, 17, 1));
this.vecStar.push(new WorldStar(81012, 1013, 17, 1));
//地飞星-兰若寺
this.vecStar.push(new WorldStar(81013, 1013, 18, 1));
this.vecStar.push(new WorldStar(81014, 1013, 18, 1));
this.vecStar.push(new WorldStar(81015, 1013, 18, 1));
//天元盛典-大唐境内
this.vecStar.push(new WorldStar(810016, 1004, 1, 3));
this.vecStar.push(new WorldStar(810017, 1004, 1, 3));
this.vecStar.push(new WorldStar(810018, 1004, 1, 3));
this.vecStar.push(new WorldStar(810019, 1004, 1, 3));
this.vecStar.push(new WorldStar(810020, 1004, 1, 3));
this.vecStar.push(new WorldStar(810021, 1004, 1, 3));
this.vecStar.push(new WorldStar(810016, 1004, 1, 3));
this.vecStar.push(new WorldStar(810017, 1004, 1, 3));
this.vecStar.push(new WorldStar(810018, 1004, 1, 3));
this.vecStar.push(new WorldStar(810019, 1004, 1, 3));
this.vecStar.push(new WorldStar(810020, 1004, 1, 3));
this.vecStar.push(new WorldStar(810021, 1004, 1, 3));
this.vecStar.push(new WorldStar(810016, 1004, 1, 3));
this.vecStar.push(new WorldStar(810017, 1004, 1, 3));
this.vecStar.push(new WorldStar(810018, 1004, 1, 3));
this.vecStar.push(new WorldStar(810019, 1004, 1, 3));
this.vecStar.push(new WorldStar(810020, 1004, 1, 3));
this.vecStar.push(new WorldStar(810021, 1004, 1, 3));
//天元盛典-东海渔村
this.vecStar.push(new WorldStar(810016, 1010, 1, 3));
this.vecStar.push(new WorldStar(810017, 1010, 1, 3));
this.vecStar.push(new WorldStar(810018, 1010, 1, 3));
this.vecStar.push(new WorldStar(810019, 1010, 1, 3));
this.vecStar.push(new WorldStar(810020, 1010, 1, 3));
this.vecStar.push(new WorldStar(810021, 1010, 1, 3));
this.vecStar.push(new WorldStar(810016, 1010, 1, 3));
this.vecStar.push(new WorldStar(810017, 1010, 1, 3));
this.vecStar.push(new WorldStar(810018, 1010, 1, 3));
this.vecStar.push(new WorldStar(810019, 1010, 1, 3));
this.vecStar.push(new WorldStar(810020, 1010, 1, 3));
this.vecStar.push(new WorldStar(810021, 1010, 1, 3));
this.vecStar.push(new WorldStar(810016, 1010, 1, 3));
this.vecStar.push(new WorldStar(810017, 1010, 1, 3));
this.vecStar.push(new WorldStar(810018, 1010, 1, 3));
this.vecStar.push(new WorldStar(810019, 1010, 1, 3));
this.vecStar.push(new WorldStar(810020, 1010, 1, 3));
this.vecStar.push(new WorldStar(810021, 1010, 1, 3));
this.vecStar.push(new WorldStar(810016, 1010, 1, 3));
//天元盛典-长安
this.vecStar.push(new WorldStar(810016, 1011, 1, 3));
this.vecStar.push(new WorldStar(810017, 1011, 1, 3));
this.vecStar.push(new WorldStar(810018, 1011, 1, 3));
this.vecStar.push(new WorldStar(810019, 1011, 1, 3));
this.vecStar.push(new WorldStar(810020, 1011, 1, 3));
this.vecStar.push(new WorldStar(810021, 1011, 1, 3));
this.vecStar.push(new WorldStar(810016, 1011, 1, 3));
this.vecStar.push(new WorldStar(810017, 1011, 1, 3));
this.vecStar.push(new WorldStar(810018, 1011, 1, 3));
this.vecStar.push(new WorldStar(810019, 1011, 1, 3));
this.vecStar.push(new WorldStar(810020, 1011, 1, 3));
this.vecStar.push(new WorldStar(810021, 1011, 1, 3));
this.vecStar.push(new WorldStar(810016, 1011, 1, 3));
this.vecStar.push(new WorldStar(810017, 1011, 1, 3));
this.vecStar.push(new WorldStar(810018, 1011, 1, 3));
this.vecStar.push(new WorldStar(810019, 1011, 1, 3));
this.vecStar.push(new WorldStar(810020, 1011, 1, 3));
this.vecStar.push(new WorldStar(810021, 1011, 1, 3));
this.vecStar.push(new WorldStar(810016, 1011, 1, 3));
//天魁星-大唐边境
this.vecStar.push(new WorldStar(82000, 1007, 1,2));
//天魁星-大唐边境
this.vecStar.push(new WorldStar(82000, 1007, 2,2));
//天魁星-大唐边境
this.vecStar.push(new WorldStar(82000, 1007, 3,2));
//天罡星-方寸山
this.vecStar.push(new WorldStar(82001, 1005, 1,2));
//天罡星-方寸山
this.vecStar.push(new WorldStar(82001, 1005, 2,2));
//天罡星-方寸山
this.vecStar.push(new WorldStar(82001, 1005, 3,2));
//天闲星-普陀山
this.vecStar.push(new WorldStar(82002, 1001, 1,2));
//天闲星-普陀山
this.vecStar.push(new WorldStar(82002, 1001, 2,2));
//天闲星-普陀山
this.vecStar.push(new WorldStar(82002, 1001, 3,2));
//天勇星-地府
this.vecStar.push(new WorldStar(82003, 1002, 1,2));
//天勇星-地府
this.vecStar.push(new WorldStar(82003, 1002, 2,2));
//天勇星-地府
this.vecStar.push(new WorldStar(82003, 1002, 3,2));
//天雄星-大唐境内
this.vecStar.push(new WorldStar(82004, 1004, 1,2));
//天雄星-大唐境内
this.vecStar.push(new WorldStar(82004, 1004, 2,2));
//天雄星-大唐境内
this.vecStar.push(new WorldStar(82004, 1004, 3,2));
//天空星-天宫
this.vecStar.push(new WorldStar(82005, 1012, 1,2));
//天空星-天宫
this.vecStar.push(new WorldStar(82005, 1012, 2,2));
//天空星-天宫
this.vecStar.push(new WorldStar(82005, 1012, 3,2));
//天寿星-天宫
this.vecStar.push(new WorldStar(82006, 1012, 1,2));
//天寿星-天宫
this.vecStar.push(new WorldStar(82006, 1012, 2,2));
//天寿星-天宫
this.vecStar.push(new WorldStar(82006, 1012, 3,2));
//天慧星-东海渔村
this.vecStar.push(new WorldStar(82007, 1010, 1,2));
//天慧星-东海渔村
this.vecStar.push(new WorldStar(82007, 1010, 2,2));
//天慧星-东海渔村
this.vecStar.push(new WorldStar(82007, 1010, 3,2));
//天牢星-长安城
this.vecStar.push(new WorldStar(82008, 1011, 1,2));
//天牢星-长安城
this.vecStar.push(new WorldStar(82008, 1011, 2,2));
//天牢星-长安城
this.vecStar.push(new WorldStar(82008, 1011, 3,2));
//天巧星-大唐境内
this.vecStar.push(new WorldStar(82009, 1004, 1,2));
//天巧星-大唐境内
this.vecStar.push(new WorldStar(82009, 1004, 2,2));
//天巧星-大唐境内
this.vecStar.push(new WorldStar(82009, 1004, 3,2));
//天捷星-方寸山
this.vecStar.push(new WorldStar(82010, 1005, 1,2));
//天捷星-方寸山
this.vecStar.push(new WorldStar(82010, 1005, 2,2));
//天捷星-方寸山
this.vecStar.push(new WorldStar(82010, 1005, 3,2));
//天微星-普陀山
this.vecStar.push(new WorldStar(82011, 1001, 1,2));
//天微星-普陀山
this.vecStar.push(new WorldStar(82011, 1001, 2,2));
//天微星-普陀山
this.vecStar.push(new WorldStar(82011, 1001, 3,2));
// 变异星君
this.variationSkyStar.push({"npcId": 82012, "name": "角木蛟", "mapid": 1001,"mapName": "普陀山", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82012, "name": "角木蛟", "mapid": 1005,"mapName": "方寸山", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82012, "name": "角木蛟", "mapid": 1004,"mapName": "大唐境内", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82013, "name": "张月鹿", "mapid": 1005,"mapName": "方寸山", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82013, "name": "张月鹿", "mapid": 1011,"mapName": "长安城", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82013, "name": "张月鹿", "mapid": 1010,"mapName": "东海渔村", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82014, "name": "井木犴", "mapid": 1002,"mapName": "地府", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82014, "name": "井木犴", "mapid": 1011,"mapName": "长安城", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82014, "name": "井木犴", "mapid": 1012,"mapName": "天宫", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82015, "name": "柳土獐", "mapid": 1002,"mapName": "地府", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82015, "name": "柳土獐", "mapid": 1011,"mapName": "长安城", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82015, "name": "柳土獐", "mapid": 1012,"mapName": "天宫", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82016, "name": "毕月乌", "mapid": 1005,"mapName": "方寸山", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82016, "name": "毕月乌", "mapid": 1011,"mapName": "长安城", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82016, "name": "毕月乌", "mapid": 1010,"mapName": "东海渔村", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82017, "name": "轸水蚓", "mapid": 1001,"mapName": "普陀山", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82017, "name": "轸水蚓", "mapid": 1005,"mapName": "方寸山", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82017, "name": "轸水蚓", "mapid": 1004,"mapName": "大唐境内", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82018, "name": "星日马", "mapid": 1002,"mapName": "地府", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82018, "name": "星日马", "mapid": 1011,"mapName": "长安城", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82018, "name": "星日马", "mapid": 1012,"mapName": "天宫", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82019, "name": "鬼金羊", "mapid": 1005,"mapName": "方寸山", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82019, "name": "鬼金羊", "mapid": 1011,"mapName": "长安城", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82019, "name": "鬼金羊", "mapid": 1010,"mapName": "东海渔村", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82020, "name": "翼火蛇", "mapid": 1005,"mapName": "方寸山", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82020, "name": "翼火蛇", "mapid": 1011,"mapName": "长安城", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82020, "name": "翼火蛇", "mapid": 1010,"mapName": "东海渔村", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82021, "name": "娄金狗", "mapid": 1002,"mapName": "地府", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82021, "name": "娄金狗", "mapid": 1011,"mapName": "长安城", "level": 3, "type": 3});
this.variationSkyStar.push({"npcId": 82021, "name": "娄金狗", "mapid": 1012,"mapName": "天宫", "level": 3, "type": 3});
this.onCreateWorldStart();
}
IsStar(nOnlyID: any): boolean {
for (let it in this.vecStar) {
let pStar = this.vecStar[it];
if (pStar.nOnlyID == nOnlyID)
return true;
}
return false;
}
onCreateWorldStart() {
let date = GTimer.getCurDate();
let cur_m = date.getMinutes();
let cur_s = date.getSeconds();
if (cur_m >= 30) {
cur_m = cur_m - 30;
}
let t = (29 - cur_m) * 60 + (60 - cur_s);
this.refresh_timer = setTimeout(() => {
this.refresh_timer = 0;
this.checkAndCreateWordStar();
}, t * 1000);
this.checkAndCreateWordStar();
}
FindStar(onlyID: number): any {
// 检查星
for (let key in this.vecStar) {
let item = this.vecStar[key];
if (item.nOnlyID == onlyID) {
return item;
}
}
// 检查变异
for (let item of this.variationList) {
if (item.nOnlyID == onlyID) {
return item;
}
}
return null;
}
ApplyChallenge(nNpcOnlyID: any, roleId: any, starlevel: any): number {
let bomb = this.FindStar(nNpcOnlyID);
if (bomb == null) {
return 1;
}
if (bomb.vecApply.length > 0) {
return 2;
}
//星级打怪不限制星级
// if (bomb.level > starlevel) {
// return 3;
// }
bomb.vecApply.push(roleId);
let self = this;
setTimeout(() => {
self.trigleStarBattle(nNpcOnlyID, roleId);
}, 500);
return 0;
}
// 挑战失败
ChallengeFail(npc_onlyid: any, battle: any) {
let pBomb: any = this.FindStar(npc_onlyid);
if (null == pBomb) {
return;
}
// 检查变异-如果死亡进行处罚
if (pBomb.type == 3) {
this.skyVariationPunish(battle);
}
pBomb.Reset();//.push(nAccountID);
}
// 检查和创造星
checkAndCreateWordStar() {
if (this.refresh_timer == 0) {
this.refresh_timer = setTimeout(() => {
this.refresh_timer = 0
this.checkAndCreateWordStar();
}, 60 * 30 * 1000);
}
for (let it in this.vecStar) {
let pWBomb = this.vecStar[it];
pWBomb.Reset();
if (pWBomb.nOnlyID > 0) {
continue;
}
let stPos = pWBomb.GetPos();
//console.log("检查和创造星",pWBomb.nNpc, pWBomb.nOnlyID, pWBomb.level, pWBomb.type);
pWBomb.nOnlyID = NpcMgr.shared.CreateNpc(pWBomb.nNpc, stPos.map, stPos.x, stPos.y, {
nKind: 0,
nID: 0
}, 0, pWBomb.level, pWBomb.type);
}
}
// 触发星战斗
trigleStarBattle(npcOnlyID: any, roleId: any) {
let star = this.FindStar(npcOnlyID);
if (star == null) {
return;
}
if (star.vecApply.length <= 0) {
return;
}
let npc = NpcMgr.shared.findNpc(npcOnlyID);
if (npc == null) {
return;
}
let player = PlayerMgr.shared.getPlayerByRoleId(roleId);
if (player == null) {
return;
}
let battle = player.monsterBattle(npc.monster_group);
if (battle == null) {
return;
}
battle.source = npcOnlyID;
}
// 清理星
CheckWorldStarDead(nOnlyID: any, battle: any) {
let flag = true;
for (let it in this.vecStar) {
let pWBomb = this.vecStar[it];
if (pWBomb.nOnlyID != nOnlyID)
continue;
pWBomb.nOnlyID = 0;
NpcMgr.shared.DeleteNpc(nOnlyID);
flag = false;
// 刷新天变
this.skyVariation(pWBomb);
if (pWBomb.level >= 13) {
this.starCurrency(battle, "击杀" + pWBomb.level + "级地煞星")
}
break;
}
if (flag) {
for (let it in this.variationList) {
let pWBomb = this.variationList[it];
if (pWBomb.nOnlyID != nOnlyID)
continue;
pWBomb.nOnlyID = 0;
NpcMgr.shared.DeleteNpc(nOnlyID);
this.variationList.splice(Number(it), 1);
break;
}
}
}
// 天-变异
skyVariation(pWBomb: any) {
if (this.variationList.length < 20) {
if (pWBomb.type == 2) {
let rand = SKDataUtil.random(0, 10);
if (rand <= 3) {
// 获取天变异 进行刷新
let sv: any = SKDataUtil.radom(this.variationSkyStar);
let pWBomb = new WorldStar(sv.npcId, sv.mapid, sv.level, 3);
pWBomb.Reset();
if (pWBomb.nOnlyID <= 0) {
let stPos = pWBomb.GetPos();
pWBomb.nOnlyID = NpcMgr.shared.CreateNpc(pWBomb.nNpc, stPos.map, stPos.x, stPos.y, {
nKind: 0,
nID: 0
}, 0, pWBomb.level, pWBomb.type);
}
this.variationList.push(pWBomb);
let strRichText = `<color=#0096ff >${sv.name}星君</c ><color=#9f20d0 >只因天界太过冷清,天罡星们百无聊赖,便决定下界</c ><color=#009f3c >${sv.mapName}</c ><color=#9f20d0 >巡玩。凡间异士得遇仙官,怎肯轻易错过机缘,于是决定与星官们讨教一番以增进修为</c >`;
PlayerMgr.shared.broadcast('s2c_game_chat', {
msg: strRichText,
scale: 3
});
}
}
}
}
// 天-变异失败处罚
skyVariationPunish(battle: any) {
if (battle != null && battle.campA != undefined) {
for (let role of battle.campA.broles) {
// 如果是玩家 并且死亡进行失败惩罚
if (role.living_type == 1 && role.isdead == true) {
let player = PlayerMgr.shared.getPlayerByOnlyId(role.onlyid)
if (player) {
if (player.relive >= 1) {
let exp: number = 10000 * player.level * 0.9 + player.relive * 15000;
player.addExp(-exp)
player.send_notice("本次战斗死亡进行惩罚!扣除经验:" + exp)
} else {
player.send_notice("你当前等级不足一转系统保护本次死亡不进行惩罚!")
}
}
}
}
}
}
// 现金奖励
starCurrency(battle: any, task_name: string) {
if (battle != null && battle.campA != undefined) {
for (let role of battle.campA.broles) {
// 如果是玩家
if (role.living_type == 1) {
let player = PlayerMgr.shared.getPlayerByOnlyId(role.onlyid)
if (player) {
Currency.shared.obtain_currency(player, task_name)
}
}
}
}
}
}