This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - Grymskvll
46
« on: July 31, 2016, 02:25:46 pm »
There already exist items that you can only buy if you meet rep requirements (things like item 30623: [Reservoir Key]). I tried adding such an item to an NPC unrelated to the reputation and it still checked my rep when buying, so I assume any item with a reputation requirement (on the item itself) will have that reputation as a purchasing requirement.
In other words, try just putting a rep requirement on items and it wont let you buy them unless you meet the requirement.
47
« on: July 31, 2016, 11:38:57 am »
Don't think there's an existing hook for it. I guess you could try to add it or request it. Regardless, wouldn't it be more elegant to use the Blizzlike currency system? I guess that might require a client-side patch for new entries in CurrencyType.dbc and maybe CurrencyCategory.dbc, unless you want to reuse an existing currency. You could maybe recycle item ID 37711: [Currency Token Test Token 1], it defaults to the "Miscellaneous" currency category and you could change the name and tooltip of the item server-side. That way, items in the vendor page would also have the right cost displayed. I don't know if that fits your design goal, though.
48
« on: July 25, 2016, 07:13:03 pm »
Couldn't find much info on this so I tried to add custom power types that go in the mana bar slot (like mana, energy, rage, runic power, focus). This is for TrinityCore 3.3.5 with Eluna and AIO. It's entirely possible that I forgot about a crucial core modification, so please let me know if there are any problems. I'm also not a very good programmer, so feel free to post improvements. [media:3bjzc74y]https://www.youtube.com/watch?v=AgKHu6Z8yig[/media:3bjzc74y] Full instructions are provided at the top of the code. Sorry for line wrap issues. It's slightly less painful on pastebin (or if you copy+paste it into an editor). Script: http://pastebin.com/asPaW32yAlternative copy: --[[INSTRUCTIONS: 1 Requires core modification to fix stance/form changing: in Unit.cpp void Unit::setPowerType(Powers new_powertype) change: case POWER_HAPPINESS: SetMaxPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier))); SetPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier))); break; to: case POWER_HAPPINESS: if (GetTypeId() == TYPEID_PLAYER && GetMaxPower(POWER_HAPPINESS) >= 0) break; SetMaxPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier))); SetPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier))); break; You may want to apply other core modifications to give POWER_HAPPINESS as neutral of a behavior as possible and script functionality specific to each custom powerType when a specific player event occurs, or add some class checks in the core when a player's POWER_HAPPINESS is manipulated.
2 If you want a class to use a custom resource, set the SERVER SIDE powertype for that class to 4 (HAPPINESS) in ChrClasses.dbc (the field that has a default value of 6 for Death Knights). Client side changes to ChrClasses.dbc are not required. Happiness is simply the powertype we use behind the scenes for all custom powertypes.
3 Next, add an entry for your custom powertype in the customPowerTypes table. Each entry should have a table of classes, an id, a powerString, a bar color table, a defaultMax value and a consumingSpells table (for correct GetSpellInfo powerType). defaultMax should be the value you want, multiplied by 1000. All Happiness values have to be multiplied by 1000.
4 To create ANY spell (in Spell.dbc) that uses or generates your custom powertype, give it a power cost or energize effect for powerType 4 (HAPPINESS). Make sure Happiness values (costs, energize effects etc) are multiplied by 1000.
TROUBLESHOOTING: Make sure that the class has the powerType set to 4 (HAPPINESS) in SERVER SIDE ChrClasses.dbc. Make sure that the class is listed in only one customPowerTypes[POWERTOKEN].classes table. Make sure table entries are separated by commas. MAKE SURE ALL RESOURCE VALUES ARE MULTIPLIED BY 1000. Happiness for some reason needs everything multiplied by 1000. That includes spell costs and generation or if you're setting current power value or maxvalue. All of them need to be multiplied by 1000. Custom spells should always use 4 (HAPPINESS) in Spell.dbc, but everywhere in-game the powerType and powerToken will match your custom values. Don't get confused and give a spell in Spell.dbc a custom cost powerType (eg. a Spell.dbc entry that costs powerType 201). It should instead have cost powerType 4 (HAPPINESS). Check the worldserver console for errors (scripts get loaded at the end). If you get UI errors in-game, keep in mind the line number might not be accurate if you have server code and client code in the same script file. Try subtracting the server-only line count, or split the script into a server file and client file.
Currently this system has some (minor?) flaws: - No error speech or text if you fail client-side resource check (not even a "Not enough happiness" message). - Spells linked in chat simply show the cost as "X Happiness", but it should be possible to alter the tooltip if the spell is found in a custom powertype's consumingSpells table. - The official Blizzard UI function UnitFrameManaBar_UpdateType(manaBar) from UnitFrame.lua is overwritten, which I guess is bad form because if the function is overwritten by two different addons, one of them will misbehave. - A class can't swap between two custom primary resources on the fly (like a druid swapping between mana, energy, rage) because the custom resource is using Happiness and MaxHappiness to store values. You would need to store extra values somewhere and change how unitframes set their manabar and change how spells' usable status is determined. ]]--
local AIO = AIO or require("AIO")
local customPowerTypes = {} -- Table for custom class resource data, used by server and client. Not all of it is used by both the server and client, but it's convenient to have everything in one place.
customPowerTypes["BRAINCELLS"] = -- Our first custom class resource, used by Shamans and Rogues (remember to set ChrClasses.dbc powerTypes to use this example) { classes = { "Shaman", "Rogue" }, -- List of classes that use this as primary resource. Remember to set powertype to 4 (HAPPINESS) in server's ChrClasses.dbc defaultMax = 300000, -- Happiness values need to be multiplied by 1000, so for the power bar to read "powertype 0 / 123", set defaultMax to 123000 id = 200, -- The id for our custom resource (first value returned by UnitPowerType). MUST BE UNIQUE. Some values below 200 are reserved for existing powerTypes. powerString = "Braincells", -- The string to be displayed for our powertype color = { r = 0.83, g = 0.76, b = 0.60 }, -- RGB colors for our power bar. Values should be between 0 and 1 consumingSpells = { 90031 } -- Spell IDs that consume this resource. Required for correct GetSpellInfo(spellID) API functionality }
customPowerTypes["TEMPER"] = -- Our second custom class resource, used by Warriors { classes = { "Warrior" }, defaultMax = 100000, id = 201, powerString = "Temper", color = { r = 1.0, g = 1.0, b = 1.0 }, consumingSpells = { 90032 }, passiveUpdate = { -- Optional passive update data, containing update interval and an update function. Event gets automatically registered, so long as you use these names ("interval" and "UpdateFunc") interval = 100, -- Update interval in milliseconds UpdateFunc = function(event, delay, repeats, player) -- power update function that gets called every [interval] milliseconds -- points (re/de)generation per second local regen = -10000 if (player:IsInCombat()) then regen = 10000 end local prevPower = player:GetPower(4) local newPower = prevPower + (regen * (delay / 1000)) local maxPower = player:GetMaxPower(4) if (newPower < 0) then newPower = 0 elseif ( newPower > maxPower ) then newPower = maxPower end player:SetPower(4, newPower) end } }
if AIO.AddAddon() then local function OnLogin(event, player) local playerclass = player:GetClassAsString() for powerToken, powerTable in pairs(customPowerTypes) do for _, class in pairs(powerTable.classes) do if (playerclass == class) then player:SetMaxPower(4, powerTable.defaultMax) -- Prevent tiny mana bar from re-appearing below the main resource bar by setting max mana to 0 (normally appears for druids while they're shapeshifted) -- Ideally you would set this class to never get any mana or maxmana increases in class levelup data player:SetMaxPower(0, 0) if (powerTable.passiveUpdate ~= nil) then player:RegisterEvent(powerTable.passiveUpdate.UpdateFunc, powerTable.passiveUpdate.interval, 0) end end end end end -- Prevent player's maximum Happiness from being reset to core default 1050 (aka 1050000). Preferably you would remove the reset in the core, because -- this way you can't change a player's maximum value without resetting it to the defaultMax, unless you store and restore desired maxpower per character local function OnLevelChange(event, player, oldLevel) local playerclass = player:GetClassAsString() for _, powerTable in pairs(customPowerTypes) do for _, class in pairs(powerTable.classes) do if (playerclass == class) then if (powerTable.defaultMax ~= nil) then player:SetMaxPower(4, powerTable.defaultMax) end end end end end RegisterPlayerEvent( 3, OnLogin ) RegisterPlayerEvent( 13, OnLevelChange ) return end
HAPPINESS_COST = "%d Happiness"; local myclass = UnitClass("player")
for customToken, powerTable in pairs(customPowerTypes) do _G[customToken] = powerTable.powerString PowerBarColor[customToken] = powerTable.color PowerBarColor[powerTable.id] = PowerBarColor[customToken] end
-- Hook official Blizzard UI function GetSpellInfo(spellId or spellName or spellLink), to fix custom powerType return, if applicable -- SpellLink as argument is broken in the official API, apparently. local origGetSpellInfo = GetSpellInfo; GetSpellInfo = function(...) local spellID = ...; local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = origGetSpellInfo(...) -- if a spellName was passed as argument, jump through some hoops to get the spellID if (type(spellID) == "string") then spellLink = GetSpellLink(spellID) if (spellLink ~= nil) then spellID = tonumber(strmatch(spellLink, "^124c%x+124Hspell:(%d+)124h%[.*%]")) end end if (spellID ~= nil) then for _, powerTable in pairs(customPowerTypes) do local earlyReturn = false for _, id in pairs(powerTable.consumingSpells) do if (id == spellID) then powerType = powerTable.id break end end if earlyReturn then break end end end return name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange; end
-- Hook official Blizzard UI function UnitPower(unit, powerType), to add custom value return, if applicable local origUnitPower = UnitPower; UnitPower = function(...) local unit, powerType = ...; if (UnitIsPlayer(unit)) then --local unitClass = UnitClass(unit) for customToken, powerTable in pairs(customPowerTypes) do if (powerTable.id == powerType) then -- ask for Happiness value instead return origUnitPower(unit, 4) end end end return origUnitPower(...); end
-- Hook official Blizzard UI function UnitPowerMax(unit, powerType), to add custom value return, if applicable local origUnitPowerMax = UnitPowerMax; UnitPowerMax = function(...) local unit, powerType = ...; if (UnitIsPlayer(unit)) then for customToken, powerTable in pairs(customPowerTypes) do if (powerTable.id == powerType) then -- ask for Happiness value instead return origUnitPowerMax(unit, 4) end end end return origUnitPowerMax(...); end
-- Hook official Blizzard UI function UnitPowerType(unit), to add custom powerType and powerToken return, if applicable local origUnitPowerType = UnitPowerType; UnitPowerType = function(...) local unit = ...; local unitClass = UnitClass(unit) for customToken, powerTable in pairs(customPowerTypes) do for _, class in pairs(powerTable.classes) do if (unitClass == class) then local powerType, _, altR, altG, altB = origUnitPowerType(unit) powerType = powerTable.id return powerType, customToken, altR, altG, altB end end end return origUnitPowerType(...); end
-- Overwrite official Blizzard UI function UnitFrameManaBar_UpdateType(manaBar), hacky fix to display Happiness value and maxvalue in mana bar function UnitFrameManaBar_UpdateType(manaBar) if ( not manaBar ) then return; end local unitFrame = manaBar:GetParent(); local powerType, powerToken, altR, altG, altB = UnitPowerType(manaBar.unit); local prefix = _G[powerToken]; local info = PowerBarColor[powerToken]; if ( info ) then if ( not manaBar.lockColor ) then manaBar:SetStatusBarColor(info.r, info.g, info.b); end else if ( not altR) then -- couldn't find a power token entry...default to indexing by power type or just mana if we don't have that either info = PowerBarColor[powerType] or PowerBarColor["MANA"]; else if ( not manaBar.lockColor ) then manaBar:SetStatusBarColor(altR, altG, altB); end end end -- We still want to use Happiness behind the scenes, so if we're using a custom resource, restore the powerType ID to 4: HAPPINESS if (customPowerTypes[powerToken] ~= nil) then powerType = 4; end manaBar.powerType = powerType; -- Update the manabar text if ( not unitFrame.noTextPrefix ) then SetTextStatusBarTextPrefix(manaBar, prefix); end TextStatusBar_UpdateTextString(manaBar);
-- Setup newbie tooltip -- FIXME: Fix this to use powerToken instead of powerType if ( manaBar.unit ~= "pet" or powerToken == "HAPPINESS" ) then if ( unitFrame:GetName() == "PlayerFrame" ) then manaBar.tooltipTitle = prefix; manaBar.tooltipText = _G["NEWBIE_TOOLTIP_MANABAR_"..powerType]; else manaBar.tooltipTitle = nil; manaBar.tooltipText = nil; end end end
local function CustomPrimaryResourceTooltip_OnShow(self, ...) local _, _, spellID = GameTooltip:GetSpell() if (spellID == nil) then return end local numLines = GameTooltip:NumLines(); local i = 1; for currentLine=1, numLines do local line = {}; local left = _G["GameTooltipTextLeft"..currentLine]; if ( left ) then line.w = true; line.leftR, line.leftG, line.leftB = left:GetTextColor(); local t = left:GetText(); local happinessCost = strmatch(t, "(%d+) Happiness") if (happinessCost ~= nil) then local _, powerToken = UnitPowerType("player") left:SetText(happinessCost.." ".._G[powerToken]) end line.left = t; end i = i + 1; end GameTooltip:Show(); end
for powerToken, powerTable in pairs(customPowerTypes) do for _, class in pairs(powerTable.classes) do if (myclass == class) then UnitFrameManaBar_UpdateType(PlayerFrameManaBar) -- Hide mini mana bar AlternatePowerBar_UpdatePowerType(PlayerFrameAlternateManaBar) end end end
GameTooltip:HookScript( "OnShow", CustomPrimaryResourceTooltip_OnShow )
49
« on: July 19, 2016, 01:02:37 am »
^there isn't any part of this that isn't great
I made a custom secondary class resource with TrinityCore, Eluna and AIO. I couldn't find an Eluna PlayerHook for when a cast is initiated, only when it finishes successfully, so I had to hack that in (poorly, probably). Handlers for the new hook can return false to stop the cast. What's the best place to request for a new PlayerHook to be added to Eluna?
[media:1ee6a4j3]https://www.youtube.com/watch?v=qHSFOsNAs_A[/media:1ee6a4j3]
50
« on: May 29, 2016, 08:37:22 pm »
Update: All you need for the icon to show up on the char creation screen is: -an entry in ChrClasses.DBC -incremented MAX_CLASSES_PER_RACE and a CLASS_ICON_TCOORDS entry in CharacterCreate.lua -a new button defined in CharacterCreate.xml All as per the guide. Make sure the CLASS_ICON_TCOORDS entry matches the all-caps name defined in ChrClasses.DBC (column 55 or 56, depending on whether columns start counting at 0 or 1). And make sure the MPQ isn't open in an MPQ editor when you launch the game. You should get something like this (I used the DK icon coords for ease): https://i.imgur.com/kRuZz3z.jpgAs you can see, there's some interface overlap because the button's position is set to below the first button of the second row, in the XML file. You can figure out where you want the button to be (and where to move other UI elements) at your leisure, or you can follow the ArcEmu guide from before regarding the button's position for an easy fix.
51
« on: May 29, 2016, 08:04:18 pm »
So do I need to put my lua and xml files back into my original WoW patches? I only have them in a new mpq patch atm. No, that's never something you should do (probably). I meant inside the actual WoW game folder, not in an archive. As for checking whether the MPQ is getting loaded, I may have jumped the gun a little with my advice. It seems the guide has you create a THIRD row of class icons, and I'm not sure how this interacts with the interface so I'll actually try to follow the guide and give an update in a moment.
52
« on: May 29, 2016, 07:56:53 pm »
I went ahead and fixed it and nothing changed. Make sure you don't have an unedited CharacterCreate.xml loading from your WowInterfaceGlueXML folder (if you have one). That's a silly snag I ran into before. Failing that, make some easily recognizable change to the class icons blp or the xml file to make sure that the files are being loaded at all. (for example, draw anatomy on the blizzard class icons, or remove the spacing between icons in the xml by setting the x offset to 0 instead of the default 6 for each button).
53
« on: May 29, 2016, 12:51:52 pm »
Thank you very much for making and updating this tool.
I have a few suggested features: -SpellFamilyFlags fields (not to be confused with masks) -option to filter spell names -configurable dropdown lists (for example, if I add a new Mechanic Type or Aura Name, I'd like to be able to add those without opening Spell.DBC in a DBC editor). I guess it should be editable in a config file or something. -annotated SpellFamilyNames (for example, if a spell has SpellFamilyName 3, it would be nice if the program noted that this is, by default, the mage family)
54
« on: May 29, 2016, 12:01:07 pm »
InterfaceGluesXML should be InterfaceGlueXML
55
« on: May 25, 2016, 07:46:12 am »
I get these errors when compiling.
If you're trying to add custom class spellscripts, I just tried this and it seemed to work fine: Core: Right click scriptsSpells folder in solution explorer. Add new item, name it spell_<class>.cpp (just like the existing class script files). Add whatever you like to your new spell_<class>.cpp. look at existing class spell script files for examples. If you copy+paste, remember to rename sensibly. Rebuild scripts and worldserver. SQL: add entries for your spell scripts in world.spell_script_names If you just want to test that it works, in Spell.dbc make a duplicate of a spell that relies on a script to work (for example, priests' Guardian Spirit: 47788), check in-game that the original works but the duplicate doesn't (because it has a different spell ID and so doesn't get to use the script yet), then add a new spell script for your duplicate that's exactly the same as the script of the original, with the only difference being the script's classname. Don't forget to add an entry in world.spell_script_names for your duplicate, that's what ties a spell ID (in Spell.dbc) to the script. By the way, I was making notes for an updated TrinityCore custom class guide and I couldn't figure out why you had to edit playermethods.h, worldsession.cpp and worldsession.h. What did you change in those files?
57
« on: March 31, 2016, 11:01:36 pm »
UnitPopup.lua has the clientside unitframe menu.
3.3.5a:
elseif ( value == "DUNGEON_DIFFICULTY" ) then if ( UnitLevel("player") < 65 and GetDungeonDifficulty() == 1 ) then UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0; end elseif ( value == "RAID_DIFFICULTY" ) then if ( UnitLevel("player") < 65 and GetRaidDifficulty() == 1 ) then UnitPopupShown[UIDROPDOWNMENU_MENU_LEVEL][index] = 0; end Change 65 to whatever you want.
58
« on: March 31, 2016, 08:13:52 pm »
Probably the easiest and cleanest way would be to change each hunter pet family's maxscale (and minscale if you want to change scale at minimum level too) in CreatureFamily.DBC (it's in your server's dbc folder). Seems like the server checks this DBC file and calculates what the pet's scale should be (between minscale and maxscale) based on the pet's level. As far as I can tell, this DBC is only used for pet scaling. See https://wowdev.wiki/DB/CreatureFamilyIf you're using TrinityCore WotLK, you can see the below code from Pet.cpp to see how this is applied. You can also change this part to get more complex scaling, such as non-linear scaling: //scale CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->family); if (cFamily && cFamily->minScale > 0.0f && petType == HUNTER_PET) { float scale; if (getLevel() >= cFamily->maxScaleLevel) scale = cFamily->maxScale; else if (getLevel() <= cFamily->minScaleLevel) scale = cFamily->minScale; else scale = cFamily->minScale + float(getLevel() - cFamily->minScaleLevel) / cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale);
SetObjectScale(scale); }
59
« on: March 31, 2016, 03:37:07 pm »
Looks cool already. Looking forward to progress.
60
« on: March 06, 2016, 09:47:06 am »
Nice! I actually started to work on same thing, but I got stuck and decided to try the other method again. Somehow I got things to work right as far as I can tell... except that you can't require more than 9+9 points spent per tier at most, or more than 9 points difference between player and pet requirements. I guess that's fine for most purposes anyway. Also I have no idea if this breaks anything, but I don't think it should. I edited my other post detailing the updated Wow.exe tooltip fix method. Edit: Nope I was wrong. I know what it is. Its's the Preview Talent Changes feature. It still thinks you need 5 talent points. So lua edits have to be made to that too. Damn, just as I thought I was done. At a glance it'll require changing PlayerTalentFrameTalent_OnClick in Blizzard_TalentUI.lua to check for our modified requirements before adding (or removing) points, because I don't see where AddPreviewTalentPoints can be changed and it isn't affected by either PLAYER_TALENTS_PER_TIER in TalentFrameBase.lua or the modified tooltip values in Wow.exe. Apparently it's a global function, whatever that is. Edit 2: I think I've fixed talent previews and tooltips. I've edited it into my second post on page 2. As far as I know, there are no bugs left and it seems to be stable. Again, I'm not very good at this so apologies if it's broken or if I made an error in my posts. I've had enough assembly for a lifetime, so report bugs at your own risk! Grrrrrr
|