diff --git a/modules/UI/shared/audioplayer.client.ts b/modules/UI/shared/audioplayer.client.ts new file mode 100644 index 0000000..0ef9886 --- /dev/null +++ b/modules/UI/shared/audioplayer.client.ts @@ -0,0 +1,10 @@ +/** @ts-expect-error */ +let aio: AIO = {}; +if(!aio.AddAddon()) { + const audioHandlers = aio.AddHandlers('AIOAudioPlayer', {}); + audioHandlers.PlaySingleSound = (sound: string) => { + print("Playing Source Sound: " + sound); + PlaySoundFile(sound, "Master"); + + }; +} \ No newline at end of file diff --git a/modules/UI/transmog/transmog.client.ts b/modules/UI/transmog/transmog.client.ts deleted file mode 100644 index e69de29..0000000 diff --git a/modules/UI/transmog/transmog.server.ts b/modules/UI/transmog/transmog.server.ts deleted file mode 100644 index a8e3a8b..0000000 --- a/modules/UI/transmog/transmog.server.ts +++ /dev/null @@ -1,10 +0,0 @@ -let aio: AIO = {}; - -import { AccountInfo } from "../../classes/account"; - -function GetTransmogItems(player: Player) { - - // SELECT * from acore_characters.custom_unlocked_appearances cua - // join acore_world.item_template it ON (cua.item_template_id = it.entry) where account_id = 252 - -} \ No newline at end of file diff --git a/modules/gameobject/gamblechest.ts b/modules/gameobject/gamblechest.ts new file mode 100644 index 0000000..47440a4 --- /dev/null +++ b/modules/gameobject/gamblechest.ts @@ -0,0 +1,150 @@ +/** @ts-expect-error */ +let aio: AIO = {}; + +const GambleChestID = 910001; +const TrapSounds = [ + "Sound\\Effects\\hell-no.mp3", + "Sound\\Effects\\bad-to-the-bone.mp3", + "Sound\\Effects\\fucked-up.mp3", +]; + +const OpeningSounds = [ + "Sound\\Effects\\crab-rave.mp3", + "Sound\\Effects\\outro-song.mp3", + "Sound\\Effects\\run-away-sax.mp3", +]; + +const LootGoodSound = "Sound\\Effects\\gold-coins.mp3"; +const LivingBombSpell = 63801; +const LongOpenChestSpellID = 24390; +const BombCreature = 19896; + + +// Contains which chests are trapped; +const LootTrapMap: Record = {}; + +function RollLootTrap(object: GameObject) { + const roll = Math.floor(Math.random() * 100); + // print(`Guid ${object.GetGUIDLow()}`); + // print(`Roll: ${roll}`); + if(roll > 98) { + object.AddLoot(43347, 1); // Satchel of Spoils 2% + LootTrapMap[object.GetGUIDLow()] = false; + return; + } else if(roll > 89) { + object.AddLoot(43346, 1); // Large Satchel of Spoils 18% + LootTrapMap[object.GetGUIDLow()] = false; + return; + } else if(roll > 82) { + object.AddLoot(49294, 1); // Ashen Sack of Spoils 7% + LootTrapMap[object.GetGUIDLow()] = false; + return; + } else if(roll > 79) { + object.AddLoot(45878, 1); // Large Sack of Uldaur Spoils 3% + LootTrapMap[object.GetGUIDLow()] = false; + return; + } else if(roll > 67) { + object.AddLoot(910001, 10); // Araxia Tokens 12% + LootTrapMap[object.GetGUIDLow()] = false; + return; + } else if(roll > 55) { + object.AddLoot(19182, 25); // Darkmoon Fair Tickets 12% + LootTrapMap[object.GetGUIDLow()] = false; + return; + } else if(roll > 45) { + object.AddLoot(52005, 1); // Satchel of Helpful Goods 10% + LootTrapMap[object.GetGUIDLow()] = false; + return; + } else if(roll > 20) { + object.AddLoot(43102, 1); // Frozen Orb 25% + LootTrapMap[object.GetGUIDLow()] = false; + return; + } else { + LootTrapMap[object.GetGUIDLow()] = true; + return; + } +} + +const onKillCreature: player_event_on_kill_creature = (event: number, killer: Player, killed: Creature) => { + const map: EMap = killed.GetMap(); + + if(!map.IsDungeon() && !map.IsRaid()) { + return false; + } + if(!map.IsHeroic()) { + return false; + } + + if(killed.GetLevel() < (killer.GetLevel() - 5)) { + return false; + } + + const [x,y,z,o] = killed.GetLocation(); + let roll = Math.floor(Math.random() * 100); + + + if(roll > 4) { + return; + } + + const object = killer.SummonGameObject(GambleChestID,x,y,z+0.3,0,100); + const objectHighlight = killer.SummonGameObject(146083,x,y,z+0.35,0,40); + + RollLootTrap(object); +} + +const onLootStateChange: gameobject_event_on_loot_state_change = (event: number, gameObject: GameObject, state: number) => { + + if(state == 2) { + + // print(`LootTrapped ${LootTrapMap[gameObject.GetGUIDLow()]}`); + // print(`InState GUID ${gameObject.GetGUIDLow()}`); + + // if it is a trap time to do some killing! + if(LootTrapMap[gameObject.GetGUIDLow()] == true) { + + const creature1: Creature = PerformIngameSpawn(1, BombCreature, gameObject.GetMapId(), gameObject.GetInstanceId(), gameObject.GetX(), gameObject.GetY(), gameObject.GetZ(),gameObject.GetO(), false, 100); + const player = gameObject.GetNearestPlayer(15); + + const sound = TrapSounds[Math.floor(Math.random() * TrapSounds.length)]; + aio.Handle(player, 'AIOAudioPlayer', 'PlaySingleSound', sound); + + player.SendNotification("Your rolled a 1, Critical Fail!"); + + for(let i =0; i < 20; i++) { + if(player.IsAlive()) { + creature1.CastSpell(player, LivingBombSpell); + } + } + + creature1.DespawnOrUnsummon(); + } else { + aio.Handle(gameObject.GetNearestPlayer(), 'AIOAudioPlayer', 'PlaySingleSound', LootGoodSound); + } + + gameObject.RemoveEventById(event); + gameObject.Despawn(); + } +}; + +// Register GameObject Event on Loot State Change +RegisterGameObjectEvent(GambleChestID,GameObjectEvents.GAMEOBJECT_EVENT_ON_LOOT_STATE_CHANGE, (...args) => onLootStateChange(...args)); + +// Register Kill Event for Mystery Chest Pop +RegisterPlayerEvent(PlayerEvents.PLAYER_EVENT_ON_KILL_CREATURE, (...args) => onKillCreature(...args)); + + + +const onSpell: player_event_on_spell_cast = (event: number, player: Player, spell: Spell, skipCheck: boolean) => { + // Implementation + const gameObjects = player.GetGameObjectsInRange(10, GambleChestID); + if(gameObjects.length > 0) { + if(spell.GetEntry() == LongOpenChestSpellID) { + const sound = OpeningSounds[Math.floor(Math.random() * OpeningSounds.length)]; + aio.Handle(player, 'AIOAudioPlayer', 'PlaySingleSound',sound); + } + } +}; + +// Register +RegisterPlayerEvent(PlayerEvents.PLAYER_EVENT_ON_SPELL_CAST, (...args) => onSpell(...args)); diff --git a/modules/items/badge-of-justice.ts b/modules/items/badge-of-justice.ts index 27012fe..a00a13f 100644 --- a/modules/items/badge-of-justice.ts +++ b/modules/items/badge-of-justice.ts @@ -10,6 +10,7 @@ const BADGE_OF_JUSTICE_BONUS = 1; const HEROIC_FOCUS_AURA = 95000; const BADGE_OF_JUSTICE_ENTRY = 29434; +const BADGE_OF_HEROISM_ENTRY = 40752; const LootToken: player_event_on_loot_item = (event: number, player: Player, item: Item) => { @@ -22,6 +23,11 @@ const LootToken: player_event_on_loot_item = (event: number, player: Player, ite } } + if(item.GetEntry() == BADGE_OF_HEROISM_ENTRY) { + player.AddItem(BADGE_OF_HEROISM_ENTRY, BADGE_OF_JUSTICE_BONUS); + + } + } diff --git a/modules/items/tokens.ts b/modules/items/tokens.ts index d375152..eabf678 100644 --- a/modules/items/tokens.ts +++ b/modules/items/tokens.ts @@ -110,6 +110,8 @@ const TokenKillEvent: player_event_on_kill_creature = (event: number, player: Pl if(roll <= rollModifer) { createChest(player, creature, 'center'); + createChest(player, creature, 'left'); + // Add player stat they created token const pStats = new PlayerStats(player); @@ -122,7 +124,7 @@ const TokenKillEvent: player_event_on_kill_creature = (event: number, player: Pl if(creature.IsWorldBoss() || creature.IsDungeonBoss()) { roll = Math.floor(Math.random() * TOKEN_ROLL_CAP); if(roll <= rollModifer+200 ) { - createChest(player, creature,'left'); + createChest(player, creature,'right'); } } } diff --git a/modules/npcs/npcbot.ts b/modules/npcs/npcbot.ts index 4241e98..5470fc8 100644 --- a/modules/npcs/npcbot.ts +++ b/modules/npcs/npcbot.ts @@ -29,42 +29,42 @@ const enterCombat: creature_event_on_enter_combat = (event: number, creature: Cr return false; } -const playerEmote: player_event_on_text_emote = (event: number, player: Player, textEmote: number, emoteNum: number, guid: number) => { +// const playerEmote: player_event_on_text_emote = (event: number, player: Player, textEmote: number, emoteNum: number, guid: number) => { - print('Emote: ' + textEmote); - print('EmoteNum: ' + emoteNum); +// print('Emote: ' + textEmote); +// print('EmoteNum: ' + emoteNum); - const unit = player.GetSelection(); +// const unit = player.GetSelection(); - if(!unit) { - return false; - } - if(unit.GetTypeId() == TypeID.TYPEID_UNIT) { - const creature = unit.ToCreature(); +// if(!unit) { +// return false; +// } +// if(unit.GetTypeId() == TypeID.TYPEID_UNIT) { +// const creature = unit.ToCreature(); - print(`BotName ${creature.GetName()}`); +// 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()}`); - } +// 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()}`); +// 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) => { @@ -134,8 +134,7 @@ RegisterCreatureEvent( (...args) => enterCombat(...args) ); -RegisterPlayerEvent(PlayerEvents.PLAYER_EVENT_ON_TEXT_EMOTE, (...args) => playerEmote(...args)); +// RegisterPlayerEvent(PlayerEvents.PLAYER_EVENT_ON_TEXT_EMOTE, (...args) => playerEmote(...args)); RegisterPlayerEvent(PlayerEvents.PLAYER_EVENT_ON_CHAT, (...args) => playerChat(...args)); -