updated plugin code for issues with second require in same code

This commit is contained in:
2024-02-05 23:43:45 -05:00
parent 1a9efd1236
commit 5731f39ca2
6 changed files with 349 additions and 53 deletions

View File

@@ -7,6 +7,7 @@ export function colors(name: string) {
PURPLE: "|cff9F3FFF",
BLUE: "|cff0070dd",
ORANGE: "|cffFF8400",
YELLOW: "|cffFFFF00",
};
const keyName = name.toUpperCase();

View File

@@ -1,3 +1,5 @@
import { BotStat, BotEquipSlot } from '../constants/idmaps';
const npcBotEmote: creature_event_on_died = (event: number, creature: Creature, player: Player) => {
// player.KillPlayer();
@@ -29,26 +31,83 @@ const enterCombat: creature_event_on_enter_combat = (event: number, creature: Cr
const playerEmote: player_event_on_text_emote = (event: number, player: Player, textEmote: number, emoteNum: number, guid: number) => {
print('Emote: ' + textEmote);
print('EmoteNum: ' + emoteNum);
const unit = player.GetSelection();
if(!unit) {
return false;
}
print(unit.GetTypeId());
if(unit.GetTypeId() == TypeID.TYPEID_UNIT) {
const creature = unit.ToCreature();
print(creature.GetName());
print(creature.IsNPCBot());
print(`BotName ${creature.GetName()}`);
if(creature.IsNPCBot()) {
const owner = creature.GetOwner();
print(owner);
if(owner !== undefined) {
print(`Owner: ${owner.GetName()}`);
print(`Bot Gear Item Level: ${creature.GetBotAverageItemLevel()}`);
print(`Bot Roles ${creature.GetBotRoles()}`);
print(`IsBotTank: ${creature.IsBotTank()}`);
print(`IsBotOffTank ${creature.IsBotOffTank()}`);
}
print(`Generic Info ------------`);
const botclass = creature.GetClass();
print(`Bot Class: ${botclass}`);
print(`Bot Str ${creature.GetBotStat(4)}`);
print(`Is Free Bot: ${creature.IsFreeBot()}`);
}
}
}
const playerChat: player_event_on_chat = (event: number, player: Player, message: string, type: number, lang: number) => {
const target = player.GetVictim();
print(target);
const unit = player.GetSelection();
if(unit) {
const creature = unit.ToCreature();
if(creature.IsNPCBot()) {
return 'hello';
let [action, item] = message.split(" ");
if(action === 'botequip') {
if(item) {
const itemEntry = parseInt(item);
if(itemEntry < 1) {
player.SendBroadcastMessage('Invalid item entry');
return false;
}
if(!player.HasItem(itemEntry, 1)) {
player.SendBroadcastMessage('You do not have that item');
return false;
}
if(itemEntry) {
creature.BotEquipItem(itemEntry, BotEquipSlot.MAINHAND);
}
} else {
const mainhand = creature.GetBotEquipment(BotEquipSlot.MAINHAND);
if(mainhand) {
print(`Mainhand: ${mainhand.GetName()}`);
creature.SendChatMessageToPlayer(ChatMsg.CHAT_MSG_SAY, Language.LANG_COMMON, `Mainhand: ${mainhand.GetItemLink()}`, player);
}
print(`Haste Rating: ${creature.GetBotStat(BotStat.HASTE_RATING)}`);
}
}
}
}
return '';
}
RegisterCreatureEvent(
@@ -80,5 +139,3 @@ RegisterPlayerEvent(PlayerEvents.PLAYER_EVENT_ON_TEXT_EMOTE, (...args) => player
RegisterPlayerEvent(PlayerEvents.PLAYER_EVENT_ON_CHAT, (...args) => playerChat(...args));
PrintError('NPC Bot loaded!');