Add files via upload

This commit is contained in:
Dinkledork
2023-02-16 12:57:09 -07:00
committed by GitHub
parent 90c77fa807
commit 0f5bac952c
3 changed files with 148 additions and 1 deletions

View File

@@ -55,4 +55,4 @@ RegisterCreatureGossipEvent(NPC_ID, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ID, 2, OnGossipSelect) RegisterCreatureGossipEvent(NPC_ID, 2, OnGossipSelect)
WorldDBQuery("DELETE FROM `creature_template` WHERE `entry`=190025;") WorldDBQuery("DELETE FROM `creature_template` WHERE `entry`=190025;")
WorldDBQuery("INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES (190025, 0, 0, 0, 0, 0, 31706, 0, 0, 0, 'Charlie', 'Character Customizer', NULL, 0, 10, 10, 0, 35, 2, 1.2, 1.24286, 1, 1, 20, 1, 0, 0, 1, 2000, 2000, 1, 1, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 2, '', 12340);") WorldDBQuery("INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES (190025, 0, 0, 0, 0, 0, 31706, 0, 0, 0, 'Charlie', 'Character Customizer', NULL, 0, 10, 10, 0, 35, 3, 1.2, 1.24286, 1, 1, 20, 1, 0, 0, 1, 2000, 2000, 1, 1, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 2, '', 12340);")

135
StartWithPet.lua Normal file
View File

@@ -0,0 +1,135 @@
------------------------------------------------------------------------------------------------
-- HUNTER START WITH PET MOD
------------------------------------------------------------------------------------------------
local EnableModule = true -- Enable module
local AnnounceModule = true -- Announce module on player login ?
local LoadFromDB = true -- true : Load beasts automatically from the database
-- false : Use PET_NPC_DB list below
-- This table is used only when LoadFromDB=false
-- entry,maxLevel
local PET_NPC_DB = {
{299,1}, -- Diseased Young Wolf
{705,1}, -- Ragged Young Wolf
{1508,1}, -- Young Scavenger
{2031,1}, -- Young Nightsaber
{3826,1}, -- Rabid Ghostpaw
{15366,1}, -- Springpaw Cub
{16520,1}, -- Vale Moth
{26016,1}, -- Tamable Wolf
{26017,1}, -- Tamable Bat
{26019,1}, -- Tamable Carrion Bird
{26020,1}, -- Tamable Boar
{26021,1}, -- Tamable Cat
{26024,1}, -- Tamable Dragonhawk
{26027,1}, -- Tamable Nether Ray
{26028,1}, -- Tamable Bird of Prey
{26029,1}, -- Tamable Raptor
{26032,1}, -- Tamable Serpent
{26033,1}, -- Tamable Spider
{26037,1}, -- Tamable Warp Stalker
{26038,1}, -- Tamable Wind Serpent
{34018,1}, -- Tamable Sporebat
{34019,1}, -- Tamable Hyena
{34021,1}, -- Tamable Moth
{34022,1}, -- Tamable Tallstrider
{34024,1}, -- Tamable Wasp
{34025,1}, -- Tamable Bear
{34026,1}, -- Tamable Crab
{34027,1}, -- Tamable Crocolisk
{34028,1}, -- Tamable Gorilla
{34029,1}, -- Tamable Turtle
}
-- spellId
local PET_SPELLS = {
883, -- Call Pet
982, -- Revive Pet
1515, -- Tame Beast
2641, -- Dismiss Pet
6991, -- Feed Pet
136 -- Mend Pet (Rank 1)
}
-- Pet happiness values
-- Unhappy = 0 - 333000
-- Content = 333001 - 666000
-- Happy = 666001 - 1050000
-- Default = 166500 (Unhappy)
local PET_STARTWITH_HAPPINESS = 500000
------------------------------------------------------------------------------------------------
-- END CONFIG
------------------------------------------------------------------------------------------------
if (not EnableModule) then return end
local FILE_NAME = string.match(debug.getinfo(1,'S').source, "[^/\\]*.lua$")
local CLASS_HUNTER = 3
local POWER_HAPPINESS = 4
local function loadPetDB()
PET_NPC_DB = {}
local Query
-- Normal/Elite Tameable beasts (non-exotic, non-rare)
if(GetCoreName() == "MaNGOS") then
Query = WorldDBQuery("SELECT Entry, MaxLevel FROM creature_template WHERE CreatureType=1 AND CreatureTypeFlags&1 <> 0 AND Type_Flags&65536 = 0 AND Family!=0 AND rank IN (0,1,5) ORDER BY MaxLevel ASC;")
elseif(GetCoreName() == "TrinityCore" or GetCoreName() == "AzerothCore") then
Query = WorldDBQuery("SELECT Entry, MaxLevel FROM creature_template WHERE Type=1 AND Type_Flags&1 <> 0 AND Type_Flags&65536 = 0 AND Family!=0 AND rank IN (0,1,5) ORDER BY MaxLevel ASC;")
end
if(Query) then
repeat
table.insert(PET_NPC_DB, {Query:GetUInt32(0), Query:GetUInt32(1)})
until not Query:NextRow()
PrintInfo("["..FILE_NAME.."][HunterStartWithPet]<loadPetDB()> Loaded "..Query:GetRowCount().." total tameable beasts from database.")
else
PrintError("["..FILE_NAME.."][HunterStartWithPet]<loadPetDB()> Could not load tameable beasts from database.")
end
end
local function onLogin(event, player)
player:SendBroadcastMessage("This server is running the |cff4CFF00HunterStartWithPet|r module.")
end
local function onFirstLogin(event, player)
if(player:GetClass() == CLASS_HUNTER) then
for _,v in ipairs(PET_SPELLS) do
player:LearnSpell(v)
end
local plevel = player:GetLevel()
local maxidx = 0
for i,v in ipairs(PET_NPC_DB) do
if (plevel >= v[2]) then
maxidx = i
else
break
end
end
-- player:SendBroadcastMessage("[|cff4CFF00HunterStartWithPet|r][DEBUG] Beast random pool size for level "..plevel..": "..maxidx)
local pet = PerformIngameSpawn(1, PET_NPC_DB[math.random(1,maxidx)][1], player:GetMapId(), player:GetInstanceId(), player:GetX()+math.cos(player:GetO()-math.pi/2), player:GetY()+math.sin(player:GetO()-math.pi/2), player:GetZ(), player:GetO(), false, 5000)
pet:SetFaction(35)
player:CastSpell(pet, 2650, true)
local guid = player:GetPetGUID()
if(guid) then
player:GetMap():GetWorldObject(guid):ToUnit():SetPower(PET_STARTWITH_HAPPINESS, POWER_HAPPINESS)
end
end
end
if (LoadFromDB) then
loadPetDB()
end
if (#PET_NPC_DB > 0) then
RegisterPlayerEvent(30, onFirstLogin) -- PLAYER_EVENT_ON_FIRST_LOGIN
if (AnnounceModule) then
RegisterPlayerEvent(3, onLogin) -- PLAYER_EVENT_ON_LOGIN
end
PrintInfo("["..FILE_NAME.."][HunterStartWithPet] Module loaded.")
else
PrintError("["..FILE_NAME.."][HunterStartWithPet] Error loading module, table `PET_NPC_DB` is empty.")
end

12
reset_instances.lua Normal file
View File

@@ -0,0 +1,12 @@
local cmd = "resetid"
local function OnCommand(event, player, command)
if command == cmd then
if not player:IsInCombat() then
player:UnbindAllInstances()
player:SendBroadcastMessage("Your instance ID's have been reset.")
end
return false
end
end
RegisterPlayerEvent(42, OnCommand)