I originally made this for public release, but I never really got around to it and relooking it its pretty messy. Just looking for comments/suggestions, pretty much just bored
Features:
- Dynamic Item Stats (100-200 str)
- Dynamic Item Properties (100-200 str or 200-500 agi)
- Sets
- Recipes
- Operator Console (easily adjustable buttons that can manipulate the inventory area)
TODO:
- Take ICI out of that damn textmacro
- Take some classes out of InventoryMain (inventorybutton, set, etc)
- Revamp the set system
- Get operator panel some more functionality.
- Do the console..
- Fix "ShowInventory"
Bottomleft of the panel is the inventory area.
Topleft of the panel is the equipment area.
Topmid of the panel is the recipe area
Bottomright of the panel is the console (tbd)
Topright is item info
Features:
- Dynamic Item Stats (100-200 str)
- Dynamic Item Properties (100-200 str or 200-500 agi)
- Sets
- Recipes
- Operator Console (easily adjustable buttons that can manipulate the inventory area)
TODO:
- Take ICI out of that damn textmacro
- Take some classes out of InventoryMain (inventorybutton, set, etc)
- Revamp the set system
- Get operator panel some more functionality.
- Do the console..
- Fix "ShowInventory"
Bottomleft of the panel is the inventory area.
Topleft of the panel is the equipment area.
Topmid of the panel is the recipe area
Bottomright of the panel is the console (tbd)
Topright is item info
JASS:
library ItemGeneration
module ITEM_GENERATION
static Table t
public static method PRIVATEOUTCAST_add takes FullItemGenerator i, integer itemId returns nothing
set t[itemId] = integer(i)
endmethod
public static string debugging = ""
private static method onPickup takes nothing returns boolean
if CustomInventory.getItemTraitData(GetManipulatedItem()) == 0 and t[GetItemTypeId(GetManipulatedItem())] != 0 then
call FullItemGenerator(t[GetItemTypeId(GetManipulatedItem())]).generate(GetManipulatedItem())
call UnitRemoveItem(GetTriggerUnit(), GetManipulatedItem())
call addItemToBag(CustomInventory.getItemTraitData(GetManipulatedItem()), GetTriggerUnit()).tooltip("1","2")
call SetItemVisible(GetManipulatedItem(), false)
elseif CustomInventory.getItemTraitData(GetManipulatedItem()) != 0 then
call CustomInventory.addItemToBag(CustomInventory.getItemTraitData(GetManipulatedItem()),GetTriggerUnit())
call UnitRemoveItem(GetTriggerUnit(), GetManipulatedItem())
call SetItemVisible(GetManipulatedItem(), false)
endif
return false
endmethod
public static method generateNewItem takes item i, unit u returns nothing
if CustomInventory.getItemTraitData(i) == 0 and t[GetItemTypeId(i)] != 0 then
call FullItemGenerator(t[GetItemTypeId(i)]).generate(i)
call UnitRemoveItem(u, i)
call addItemToBag(CustomInventory.getItemTraitData(i), u).tooltip("1","2")
call SetItemVisible(i, false)
elseif CustomInventory.getItemTraitData(i) != 0 then
call CustomInventory.addItemToBag(CustomInventory.getItemTraitData(i),u)
call UnitRemoveItem(u, i)
call SetItemVisible(i, false)
endif
endmethod
public static method initsiesss takes nothing returns nothing
local item i
local FullItemGenerator fullItemGenerator
local Recipe2 r
local Set s
local integer i3 = 0
local trigger tr = CreateTrigger()
//INITIALIZATION SCRIPT
set t = Table.create()
call TriggerAddCondition(tr, Filter(function thistype.onPickup))
call TriggerRegisterAnyUnitEventBJ(tr, EVENT_PLAYER_UNIT_PICKUP_ITEM)
set tr = null
//END INITIALIZATION SCRIPT
//TROLL WIZZY
set s = Set.create("Troll Wizard's Armaments", "|cffffcc00Description|r : The many pieces of the Troll Wizard's wardrobe which were constantly"/*
*/+"run with energy while the Troll Wizard was in combat.\n\n|cffffcc00Pieces|r\n|cffffcc00 -|r Troll Wizard's Brilliant Essence"/*
*/+"\n|cffffcc00 -|r Troll Wizard's Luminescent Gloves\n|cffffcc00 -|r Troll Wizard's Silk Robez\n|cffffcc00 -|r Troll Wizard's Shining Ring"/*
*/+"\n|cffffcc00 -|r Troll Wizard's Shimmering Amulet\n|cffffcc00 -|r Troll Wizard's Long Staff\n|cffffcc00 -|r Troll Wizard's Floating Orb"/*
*/+"\n\n|cffffcc00Bonuses|r\n|cffffcc00 (3) Intelligence|r : 15\n|cffffcc00 (5) Spell Critical Rate|r : 5%\n|cffffcc00 (7) |r10% chance to renanimate as: Troll Wizard"/*
*/+"\n|cffffcc00 (7) Spell Critical Damage|r : 50%\n|cffffcc00 (7) Intelligence|r : 20")
call s.addTrait(TRAIT_TYPE_INTELLIGENCE, 15, 3)
call s.addTrait(TRAIT_TYPE_SPELL_CRIT_RATE, 5, 5)
call s.addTrait(TRAIT_TYPE_SPELL_CRIT_POW, 50, 7)
call s.addTrait(TRAIT_TYPE_INTELLIGENCE, 20, 7)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll Wizard's Brillant Essence|r", /*
*/"|cffffcc00Description|r : The Troll Wizard would collect the souls of its victim and embottle them in order to gain their strength.|n|cff008000|nPart of the Troll Wizard's Armaments set|r"/*
*/, 'B02W', SLOT_WING).register('I00M')/*
*/.addSCT(TRAIT_TYPE_ALL_STATS,5,5,0)/*
*/.addSCT(TRAIT_TYPE_MOVEMENT_SPEED,30,30,0)/*
*/.addSet(s)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll Wizard's Luminescent Gloves|r", /*
*/"|cffffcc00Description|r : Every hand needs a glove.|n|cff008000|nPart of the Troll Wizard's Armaments set|r"/*
*/, 'B02X', SLOT_GLOVE).register('I02D')/*
*/.addSCT(TRAIT_TYPE_ATTACK_SPEED,10,10,0)/*
*/.addSCT(TRAIT_TYPE_INTELLIGENCE,5,5,0)/*
*/.addSet(s)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll Wizard's Silk Robes|r", /*
*/"|cffffcc00Description|r : The Troll's robes leached the energy that was coming from his staff and enchanted themselves.|n|cff008000|nPart of the Troll Wizard's Armaments set|r"/*
*/, 'B02N', SLOT_ARMOR).register('I026')/*
*/.addSCT(TRAIT_TYPE_ARMOR,4,4,0)/*
*/.addSCT(TRAIT_TYPE_INTELLIGENCE,9,9,0)/*
*/.addSet(s)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll Wizard's Shining Ring|r", /*
*/"|cffffcc00Description|r : Rather than the Troll King's ring, this ring embodies the mind and spirit.|n|cff008000|nPart of the Troll Wizard's Armaments set|r"/*
*/, 'B02L', SLOT_RINGRIGHT).register('I01V')/*
*/.addSCT(TRAIT_TYPE_INTELLIGENCE,9,9,0)/*
*/.addSCT(TRAIT_TYPE_STRENGTH,4,4,0)/*
*/.addSCT(TRAIT_TYPE_AGILITY,4,4,0)/*
*/.addSet(s)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll Wizard's Long Staff|r", /*
*/"|cffffcc00Description|r : This staff is glowing with energy through so much use from the Troll Wizard.|n|cff008000|nPart of the Troll Wizard's Armaments set|r"/*
*/, 'B02M', SLOT_MAINHAND).register('I01W')/*
*/.addSCT(TRAIT_TYPE_DAMAGE,20,20,0)/*
*/.addSCT(TRAIT_TYPE_INTELLIGENCE,10,10,0)/*
*/.addSet(s)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll Wizard's Floating Orb|r", /*
*/"|cffffcc00Description|r : Acted as a battery for the Troll Wizard's magic.|n|cff008000|nPart of the Troll Wizard's Armaments set|r"/*
*/, 'B02B', SLOT_OFFHANDONLY).register('I01X')/*
*/.addSCT(TRAIT_TYPE_DAMAGE,10,10,0)/*
*/.addSCT(TRAIT_TYPE_INTELLIGENCE,10,10,0)/*
*/.addSet(s)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll Wizard's Shimmering Amulet|r", /*
*/"|cffffcc00Description|r : The coup-de-gras of the Troll Wizard's armaments, this amulet was used as the eye of energy, making the Wizard's magic able to focus itself.|n|cff008000|nPart of the Troll Wizard's Armaments set|r"/*
*/, 'B02T', SLOT_NECKLACE).register('I01Y')/*
*/.addSCT(TRAIT_TYPE_INTELLIGENCE,15,15,0)/*
*/.addSCT(TRAIT_TYPE_STRENGTH,5,5,0)/*
*/.addSCT(TRAIT_TYPE_AGILITY,5,5,0)/*
*/.addSet(s)
//END TROLLWIZY
//TROLL KING
set s = Set.create("Troll King's Garments", "|cffffcc00Description|r : The many parts of the Troll King that made him once so great.\n"/*
*/+"\n|cffffcc00Pieces\n - |r Troll King's Belt\n|cffffcc00 - |rTroll King's Crown\n|cffffcc00 - |rTroll King's Chest Protector"/*
*/+"\n|cffffcc00 - |rTroll King's Majestic Ring\n|cffffcc00 - |rTroll King's Emerald Amulet\n|cffffcc00 - |rTroll King's Bronze Sword"/*
*/+"\n|cffffcc00 - |rTroll King's Broken Dagger\n\n|cffffcc00Bonuses|r\n|cffffcc00 (3)|r |cffffcc00Strength/Agility\r : 10\n|cffffcc00 (5)"/*
*/+"|cffffcc00Attack Speed|r : 15%\n|cffffcc00 (7)|r 15% of slain enemies reanimate as: Troll Warrior\n |cffffcc00Armor|r : 5\n |cffffcc00All Stats|r : 15")
call s.addTrait(TRAIT_TYPE_STRENGTH, 10, 3)
call s.addTrait(TRAIT_TYPE_AGILITY, 10, 3)
call s.addTrait(TRAIT_TYPE_ATTACK_SPEED, 15, 5)
call s.addTrait(TRAIT_TYPE_ALL_STATS, 10, 7)
call s.addTrait(TRAIT_TYPE_ARMOR, 5, 7)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll King's Belt|r", /*
*/"|cffffcc00Description|r : Held the legendary stomach of the Troll King|n|n|cff008000Part of the Troll King's Equipment set|r"/*
*/, 'B02W', SLOT_BELT).register('I020')/*
*/.addSCT(TRAIT_TYPE_ARMOR,2,2,0)/*
*/.addSCT(TRAIT_TYPE_STRENGTH,5,5,0)/*
*/.addSet(s)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll King's Crown|r", /*
*/"|cffffcc00Description|r : Once protected the head of the Troll King. Once.|n|n|cff008000Part of the Troll King's Equipment set|r"/*
*/, 'B02U', SLOT_HELM).register('I00D')/*
*/.addSCT(TRAIT_TYPE_ARMOR,2,2,0)/*
*/.addSCT(TRAIT_TYPE_ALL_STATS,3,3,0)/*
*/.addSet(s)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll King's Chest Protector|r", /*
*/"|cffffcc00Description|r : Protected the stomach of the Troll King.|n|n|cff008000Part of the Troll King's Equipment set|r"/*
*/, 'B02F', SLOT_ARMOR).register('I00E')/*
*/.addSCT(TRAIT_TYPE_ARMOR,5,5,0)/*
*/.addSCT(TRAIT_TYPE_STRENGTH,7,7,0)/*
*/.addSCT(TRAIT_TYPE_AGILITY,4,4,0)/*
*/.addSet(s)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll King's Majestic Ring|r", /*
*/"|cffffcc00Description|r : One of many on the Troll King's fingers which he stole from the women of plundered villages.|n|n|cff008000Part of the Troll King's Equipment set|r"/*
*/, 'B02C', SLOT_RINGRIGHT).register('I025')/*
*/.addSCT(TRAIT_TYPE_INTELLIGENCE,5,5,0)/*
*/.addSCT(TRAIT_TYPE_STRENGTH,8,8,0)/*
*/.addSCT(TRAIT_TYPE_AGILITY,8,8,0)/*
*/.addSet(s)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll King's Emerald Amulet|r", /*
*/"|cffffcc00Description|r : The Troll King's favorite, which was taken from a widow who tried to steal from the Troll King.|n|n|cff008000Part of the Troll King's Equipment set|r"/*
*/, 'B02T', SLOT_NECKLACE).register('I01Z')/*
*/.addSCT(TRAIT_TYPE_ALL_STATS,6,6,0)/*
*/.addSet(s)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll King's Bronze Sword|r", /*
*/"|cffffcc00Description|r : One of the discarded swords of the Troll King.|n|n|cff008000Part of the Troll King's Equipment set|r"/*
*/, 'B02I', SLOT_MAINHAND).register('I021')/*
*/.addSCT(TRAIT_TYPE_DAMAGE,20,20,0)/*
*/.addSCT(TRAIT_TYPE_STRENGTH,5,5,0)/*
*/.addSet(s)
set fullItemGenerator = FullItemGenerator.create("|cff008000Troll King's Broken Dagger|r", /*
*/"|cffffcc00Description|r : Kept in a holster of the Troll King in case his sword broke.|n|n|cff008000Part of the Troll King's Equipment set|r"/*
*/, 'B02V', SLOT_OFFHAND).register('I024')/*
*/.addSCT(TRAIT_TYPE_DAMAGE,10,10,0)/*
*/.addSCT(TRAIT_TYPE_STRENGTH,5,5,0)/*
*/.addSCT(TRAIT_TYPE_AGILITY,5,5,0)/*
*/.addSCT(TRAIT_TYPE_ATTACK_SPEED,10,10,0)/*
*/.addSet(s)
//END TROLL KING
//WEAK IRON SCRAP
set fullItemGenerator = FullItemGenerator.create("Weak Iron Scrap", /*
*/"|cffffcc00Description|r : Used in various blacksmithing recipes", 'B02O', TYPE_MATERIAL).register('I00U')
set fullItemGenerator = FullItemGenerator.create("Iron Scrap", /*
*/"|cffffcc00Description|r : Used in various blacksmithing recipes", 'B02O', TYPE_MATERIAL).register('I01M')
set fullItemGenerator = FullItemGenerator.create("Hand-sharpened Iron Scrap", /*
*/"|cffffcc00Description|r : Used in various blacksmithing recipes", 'B02O', TYPE_MATERIAL).register('I01N')
//END WIS
//FLIMSY SWORD
//FIG Creation
set fullItemGenerator = FullItemGenerator.create("Flimsy Sword", /*
*/"|cffffcc00Item Type |r- 1-H Weapon|n|cffffcc00Class Requirement|r : Warrior", 'B02I', SLOT_OFFHAND)/*
*/.addSingleChangingTrait(TRAIT_TYPE_DAMAGE,2,2,0)/*
*/.register('I002')
set fullItemGenerator = FullItemGenerator.create("Flimsy Sword +", /*
*/"|cffffcc00Item Type |r- 1-H Weapon|n|cffffcc00Class Requirement|r : Warrior", 'B02I', SLOT_OFFHAND)/*
*/.addSingleChangingTrait(TRAIT_TYPE_DAMAGE,3,3,0)/*
*/.register('I00Y')
set fullItemGenerator = FullItemGenerator.create("Flimsy Sword ++", /*
*/"|cffffcc00Item Type |r- 1-H Weapon|n|cffffcc00Class Requirement|r : Warrior", 'B02I', SLOT_OFFHAND)/*
*/.addSingleChangingTrait(TRAIT_TYPE_DAMAGE,4,5,0)/*
*/.register('I017')
set fullItemGenerator = FullItemGenerator.create("Flimsy Sword +++", /*
*/"|cffffcc00Item Type |r- 1-H Weapon|n|cffffcc00Class Requirement|r : Warrior", 'B02I', SLOT_OFFHAND)/*
*/.addSingleChangingTrait(TRAIT_TYPE_DAMAGE,6,7,0)/*
*/.register('I01G')
//END FLIMSY SWORD
//BRANCH
set fullItemGenerator = FullItemGenerator.create("Flimsy Branch", /*
*/"|cffffcc00Item Type|r : 2-Handed Weapon|n|cffffcc00Class Requirement|r : Wizard, Witch", 'B02P', SLOT_MAINHAND)/*
*/.addSingleChangingTrait(TRAIT_TYPE_DAMAGE,2,2,0)/*
*/.addSingleChangingTrait(TRAIT_TYPE_INTELLIGENCE,2,2,0)/*
*/.register('I00O')
set fullItemGenerator = FullItemGenerator.create("Flimsy Branch +", /*
*/"|cffffcc00Item Type|r : 2-Handed Weapon|n|cffffcc00Class Requirement|r : Wizard, Witch", 'B02P', SLOT_MAINHAND)/*
*/.addSingleChangingTrait(TRAIT_TYPE_DAMAGE,3,3,0)/*
*/.addSingleChangingTrait(TRAIT_TYPE_INTELLIGENCE,3,3,0)/*
*/.register('I00V')
set fullItemGenerator = FullItemGenerator.create("Flimsy Branch ++", /*
*/"|cffffcc00Item Type|r : 2-Handed Weapon|n|cffffcc00Class Requirement|r : Wizard, Witch", 'B02P', SLOT_MAINHAND)/*
*/.addSingleChangingTrait(TRAIT_TYPE_DAMAGE,3,4,0)/*
*/.addSingleChangingTrait(TRAIT_TYPE_INTELLIGENCE,3,4,0)/*
*/.register('I01D')
set fullItemGenerator = FullItemGenerator.create("Flimsy Branch +++", /*
*/"|cffffcc00Item Type|r : 2-Handed Weapon|n|cffffcc00Class Requirement|r : Wizard, Witch", 'B02P', SLOT_MAINHAND)/*
*/.addSingleChangingTrait(TRAIT_TYPE_DAMAGE,4,5,0)/*
*/.addSingleChangingTrait(TRAIT_TYPE_INTELLIGENCE,4,5,0)/*
*/.register('I014')
//END BRANCH
//CRACKED RING
set fullItemGenerator = FullItemGenerator.create("Cracked Ring", /*
*/"|cffffcc00Item Type|r : Ring", 'B02E', SLOT_RINGRIGHT)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ALL_STATS,2,2,0)/*
*/.register('I00S')
set fullItemGenerator = FullItemGenerator.create("Cracked Ring +", /*
*/"|cffffcc00Item Type|r : Ring", 'B02E', SLOT_RINGRIGHT)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ALL_STATS,2,3,0)/*
*/.register('I016')
set fullItemGenerator = FullItemGenerator.create("Cracked Ring ++", /*
*/"|cffffcc00Item Type|r : Ring", 'B02E', SLOT_RINGRIGHT)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ALL_STATS,3,4,0)/*
*/.register('I01E')
set fullItemGenerator = FullItemGenerator.create("Cracked Ring +++", /*
*/"|cffffcc00Item Type|r : Ring", 'B02E', SLOT_RINGRIGHT)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ALL_STATS,4,6,0)/*
*/.register('I00W')
//END CRACKED RING
//FLIMSY ARMOR
set fullItemGenerator = FullItemGenerator.create("Flimsy Armor",/*
*/"|cffffcc00Item Type |r: Armor", 'B02F', SLOT_ARMOR)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ARMOR,1,1,0)/*
*/.register('I004')
set fullItemGenerator = FullItemGenerator.create("Flimsy Armor +",/*
*/"|cffffcc00Item Type |r: Armor", 'B02F', SLOT_ARMOR)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ARMOR,1,2,0)/*
*/.register('I00X')
set fullItemGenerator = FullItemGenerator.create("Flimsy Armor ++",/*
*/"|cffffcc00Item Type |r: Armor", 'B02F', SLOT_ARMOR)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ARMOR,2,2,0)/*
*/.register('I01F')
set fullItemGenerator = FullItemGenerator.create("Flimsy Armor +++",/*
*/"|cffffcc00Item Type |r: Armor", 'B02F', SLOT_ARMOR)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ARMOR,3,3,0)/*
*/.register('I015')
//END FLIMSY ARMOR
//LEATHER QUIVER
set fullItemGenerator = FullItemGenerator.create("Leather Quiver",/*
*/"|cffffcc00Item Type |r: Offhand|n|cffffcc00Class Requirement|r : Archer", 'B02Q', SLOT_OFFHANDONLY)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ATTACK_SPEED,2,2,0)/*
*/.register('I00F')
set fullItemGenerator = FullItemGenerator.create("Leather Quiver +",/*
*/"|cffffcc00Item Type |r: Offhand|n|cffffcc00Class Requirement|r : Archer", 'B02Q', SLOT_OFFHANDONLY)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ATTACK_SPEED,3,4,0)/*
*/.register('I00Z')
set fullItemGenerator = FullItemGenerator.create("Leather Quiver ++",/*
*/"|cffffcc00Item Type |r: Offhand|n|cffffcc00Class Requirement|r : Archer", 'B02Q', SLOT_OFFHANDONLY)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ATTACK_SPEED,5,6,0)/*
*/.register('I018')
set fullItemGenerator = FullItemGenerator.create("Leather Quiver +++",/*
*/"|cffffcc00Item Type |r: Offhand|n|cffffcc00Class Requirement|r : Archer", 'B02Q', SLOT_OFFHANDONLY)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ATTACK_SPEED,7,8,0)/*
*/.register('I01H')
//END LEATHER QUIVER
//ROUGH SLIPPERS
set fullItemGenerator = FullItemGenerator.create("Rough Slippers",/*
*/"|cffffcc00Item Type |r: Boots", 'B02G', SLOT_BOOTS)/*
*/.addSingleChangingTrait(TRAIT_TYPE_MOVEMENT_SPEED,5,5,0)/*
*/.register('I00K')
set fullItemGenerator = FullItemGenerator.create("Rough Slippers +",/*
*/"|cffffcc00Item Type |r: Boots", 'B02G', SLOT_BOOTS)/*
*/.addSingleChangingTrait(TRAIT_TYPE_MOVEMENT_SPEED,7,9,0)/*
*/.register('I010')
set fullItemGenerator = FullItemGenerator.create("Rough Slippers ++",/*
*/"|cffffcc00Item Type |r: Boots", 'B02G', SLOT_BOOTS)/*
*/.addSingleChangingTrait(TRAIT_TYPE_MOVEMENT_SPEED,11,13,0)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ARMOR,1,1,0)/*
*/.register('I019')
set fullItemGenerator = FullItemGenerator.create("Rough Slippers +++",/*
*/"|cffffcc00Item Type |r: Boots", 'B02G', SLOT_BOOTS)/*
*/.addSingleChangingTrait(TRAIT_TYPE_MOVEMENT_SPEED,13,15,0)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ARMOR,1,2,0)/*
*/.register('I01I')
//END ROUGH SLIPPERS
//TWIG BOW
set fullItemGenerator = FullItemGenerator.create("Twig Bow",/*
*/"|cffffcc00Item Type |r: 1-H Mainhand|n|cffffcc00Class Requirement|r : Archer", 'B02R', SLOT_MAINHAND)/*
*/.addSingleChangingTrait(TRAIT_TYPE_DAMAGE,3,3,0)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ATTACK_SPEED,-15,-15,0)/*
*/.register('I00G')
set fullItemGenerator = FullItemGenerator.create("Twig Bow +",/*
*/"|cffffcc00Item Type |r: 1-H Mainhand|n|cffffcc00Class Requirement|r : Archer", 'B02R', SLOT_MAINHAND)/*
*/.addSingleChangingTrait(TRAIT_TYPE_DAMAGE,5,6,0)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ATTACK_SPEED,-15,-15,0)/*
*/.register('I012')
set fullItemGenerator = FullItemGenerator.create("Twig Bow ++",/*
*/"|cffffcc00Item Type |r: 1-H Mainhand|n|cffffcc00Class Requirement|r : Archer", 'B02R', SLOT_MAINHAND)/*
*/.addSingleChangingTrait(TRAIT_TYPE_DAMAGE,7,8,0)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ATTACK_SPEED,-15,-15,0)/*
*/.register('I01A')
set fullItemGenerator = FullItemGenerator.create("Twig Bow +++",/*
*/"|cffffcc00Item Type |r: 1-H Mainhand|n|cffffcc00Class Requirement|r : Archer", 'B02R', SLOT_MAINHAND)/*
*/.addSingleChangingTrait(TRAIT_TYPE_DAMAGE,9,11,0)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ATTACK_SPEED,-15,-15,0)/*
*/.register('I01J')
//END TWIG BOW
//WEAK GLOVES
set fullItemGenerator = FullItemGenerator.create("Weak Gloves",/*
*/"|cffffcc00Item Type |r: Gloves", 'B02H', SLOT_GLOVE)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ATTACK_SPEED,1,1,0)/*
*/.register('I00H')
set fullItemGenerator = FullItemGenerator.create("Weak Gloves +",/*
*/"|cffffcc00Item Type |r: Gloves", 'B02H', SLOT_GLOVE)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ATTACK_SPEED,1,2,0)/*
*/.register('I011')
set fullItemGenerator = FullItemGenerator.create("Weak Gloves ++",/*
*/"|cffffcc00Item Type |r: Gloves", 'B02H', SLOT_GLOVE)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ATTACK_SPEED,2,3,0)/*
*/.register('I01B')
set fullItemGenerator = FullItemGenerator.create("Weak Gloves +++",/*
*/"|cffffcc00Item Type |r: Gloves", 'B02H', SLOT_GLOVE)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ATTACK_SPEED,3,4,0)/*
*/.register('I01K')
//END WEAK GLOVES
//WEAK MASK
set fullItemGenerator = FullItemGenerator.create("Weak Mask",/*
*/"|cffffcc00Item Type |r: Helmet", 'B02S', SLOT_HELM)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ARMOR,1,1,0)/*
*/.register('I00J')
set fullItemGenerator = FullItemGenerator.create("Weak Mask +",/*
*/"|cffffcc00Item Type |r: Helmet", 'B02S', SLOT_HELM)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ARMOR,1,2,0)/*
*/.register('I013')
set fullItemGenerator = FullItemGenerator.create("Weak Mask ++",/*
*/"|cffffcc00Item Type |r: Helmet", 'B02S', SLOT_HELM)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ARMOR,1,2,0)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ALL_STATS,1,1,0)/*
*/.register('I01C')
set fullItemGenerator = FullItemGenerator.create("Weak Mask +++",/*
*/"|cffffcc00Item Type |r: Helmet", 'B02S', SLOT_HELM)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ARMOR,2,2,0)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ALL_STATS,1,2,0)/*
*/.register('I01L')
//END WEAK MASK
//SUN FRAGMENT OF HELIOS
set fullItemGenerator = FullItemGenerator.create("|cffff4500Sun Fragment of Helios|r",/*
*/"Contains the blazing heat by which Helios created the Sun.", 'B01H', 8)/*
*/.addSingleChangingTrait(TRAIT_TYPE_ALL_STATS,20000,50000,0)/*
*/.addReq(TRAIT_REQ_LEVEL, 2)/*
*/.register('I000')
//END SUN FRAGMENT OF HELIOS
//SWORD OF TRUTH
set fullItemGenerator = FullItemGenerator.create("|cffff4500The Sword of Truth|r", "The one and only.", 'B029', 6)/*
*/.addGroupChangingTrait(TRAIT_TYPE_DAMAGE,500000,1000000,0,15)/*
*/.addGCT(TRAIT_TYPE_STATIC_DAMAGE, 500000, 1000000,0,5)/*
*/.closeGroup()/*
*/.addGCT(TRAIT_TYPE_STRENGTH, 75000, 150000,0,5)/*
*/.addGCT(TRAIT_TYPE_AGILITY, 75000, 150000,0,5)/*
*/.addGCT(TRAIT_TYPE_ALL_STATS, 50000, 100000,0,5)/*
*/.closeGroup()/*
*/.addGCT(TRAIT_TYPE_LIFE, 500000, 1000000,0,5)/*
*/.addGCT(TRAIT_TYPE_MANA, 150, 250,0,5)/*
*/.closeGroup()/*
*/.addGCT(TRAIT_TYPE_ARMOR_REDUCTION, 750,1250,0,5)/*
*/.addGCT(TRAIT_TYPE_ATTACK_SPEED, 50, 100,0,5)/*
*/.closeGroup()/*
*/.register('I00L')
//END SWORD OF TRUTH
//GOTUMGEAR
set fullItemGenerator = FullItemGenerator.create("[Recipe] Gotum Gear +",/*
*/ "|cffffcc00Description|r : Upgrades any piece of gear from the weapon salesman in Gotum.|n|n|cffffcc00Recipe|r : Recipe + Any piece of gear + Weak Iron Scrap + Corresponding Material|n|n|cffffcc00Hint|r : 'Corresponding Material' is sold at the Materials Salesman",/*
*/'B02A', TYPE_RECIPE)
call fullItemGenerator/*
*/.register('I006')/*
*/.addNewRecipe()/*
*/.addPiece(0, 'I00O')/*
*/.addPiece(1, 'I00U')/*
*/.addResult('I00V')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I00S')/*
*/.addPiece(1, 'I00U')/*
*/.addResult('I016')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I004')/*
*/.addPiece(1, 'I00U')/*
*/.addResult('I00X')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I002')/*
*/.addPiece(1, 'I00U')/*
*/.addResult('I00Y')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I00F')/*
*/.addPiece(1, 'I00U')/*
*/.addResult('I00Z')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I00K')/*
*/.addPiece(1, 'I00U')/*
*/.addResult('I010')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I00G')/*
*/.addPiece(1, 'I00U')/*
*/.addResult('I012')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I00H')/*
*/.addPiece(1, 'I00U')/*
*/.addResult('I011')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I00J')/*
*/.addPiece(1, 'I00U')/*
*/.addResult('I013')
//ENDGOTUM
//GOTUM+
set fullItemGenerator = FullItemGenerator.create("[Recipe] Gotum Gear ++",/*
*/ "|cffffcc00Description|r : Upgrades any piece of gear from the weapon salesman in Gotum.|n|n|cffffcc00Recipe|r : Recipe + Any single-plus piece of gear + Iron Scrap + Corresponding Material|n|n|cffffcc00Hint|r : 'Corresponding Material' is sold at the Materials Salesman",/*
*/'B02A', TYPE_RECIPE)
call fullItemGenerator/*
*/.register('I007')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I00V')/*
*/.addPiece(1, 'I01M')/*
*/.addResult('I01D')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I016')/*
*/.addPiece(1, 'I01M')/*
*/.addResult('I01E')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I00X')/*
*/.addPiece(1, 'I01M')/*
*/.addResult('I01F')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I00Y')/*
*/.addPiece(1, 'I01M')/*
*/.addResult('I017')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I00Z')/*
*/.addPiece(1, 'I01M')/*
*/.addResult('I018')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I010')/*
*/.addPiece(1, 'I01M')/*
*/.addResult('I019')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I012')/*
*/.addPiece(1, 'I01M')/*
*/.addResult('I01A')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I011')/*
*/.addPiece(1, 'I01M')/*
*/.addResult('I01B')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I013')/*
*/.addPiece(1, 'I01M')/*
*/.addResult('I01C')
//ENDGOTUM+
//GOTUM++
set fullItemGenerator = FullItemGenerator.create("[Recipe] Gotum Gear +++",/*
*/ "|cffffcc00Description|r : Upgrades any piece of gear from the weapon salesman in Gotum.|n|n|cffffcc00Recipe|r : Recipe + Any double-plus piece of gear + Hand-sharpened Iron Scrap + Corresponding Material|n|n|cffffcc00Hint|r : 'Corresponding Material' is sold at the Materials Salesman",/*
*/'B02A', TYPE_RECIPE)
call fullItemGenerator/*
*/.register('I00C')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I01D')/*
*/.addPiece(1, 'I01N')/*
*/.addResult('I014')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I01E')/*
*/.addPiece(1, 'I01N')/*
*/.addResult('I00W')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I01F')/*
*/.addPiece(1, 'I01N')/*
*/.addResult('I015')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I017')/*
*/.addPiece(1, 'I01N')/*
*/.addResult('I01G')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I018')/*
*/.addPiece(1, 'I01N')/*
*/.addResult('I01H')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I019')/*
*/.addPiece(1, 'I01N')/*
*/.addResult('I01I')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I01A')/*
*/.addPiece(1, 'I01N')/*
*/.addResult('I01J')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I01B')/*
*/.addPiece(1, 'I01N')/*
*/.addResult('I01K')
call fullItemGenerator.addNewRecipe()/*
*/.addPiece(0, 'I01C')/*
*/.addPiece(1, 'I01N')/*
*/.addResult('I01L')
//ENDGOTUM++
endmethod
endmodule
endlibrary
http://pastebin.com/66T5dtvP
JASS:
library TraitConstants
globals
constant integer SLOT_BELT = 1
constant integer SLOT_HELM = 2
constant integer SLOT_GLOVE = 3
constant integer SLOT_ARMOR = 4
constant integer SLOT_MAINHAND = 5
constant integer SLOT_OFFHAND = 6
constant integer SLOT_OFFHANDONLY = 101
constant integer SLOT_RINGLEFT = 7
constant integer SLOT_RINGRIGHT = 8
constant integer SLOT_BOOTS = 9
constant integer SLOT_NECKLACE = 10
constant integer SLOT_PANTS = 11
constant integer SLOT_WING = 12
constant integer TYPE_RECIPE = 50
constant integer TYPE_MATERIAL = 51
//Damage
constant integer TRAIT_TYPE_DAMAGE = 1
constant integer TRAIT_TYPE_FIRE_DAMAGE = 3
constant integer TRAIT_TYPE_LIGHTNING_DAMAGE = 4
constant integer TRAIT_TYPE_STATIC_DAMAGE = 14
constant integer TRAIT_TYPE_COLD_DAMAGE = 9
constant integer TRAIT_TYPE_POISON_DAMAGE = 23
constant integer TRAIT_TYPE_FIRE_MAX_DAMAGE = 8
constant integer TRAIT_TYPE_STATIC_MAX_DAMAGE = 12
constant integer TRAIT_TYPE_LIGHTNING_MAX_DAMAGE = 21
constant integer TRAIT_TYPE_COLD_MAX_DAMAGE = 22
constant integer TRAIT_TYPE_POISON_MAX_DAMAGE = 24
//Damage Affix
constant integer TRAIT_TYPE_ATTACK_SPEED = 17
constant integer TRAIT_TYPE_LIFE_LEECH = 19
constant integer TRAIT_TYPE_ARMOR_REDUCTION = 37
//Armor
constant integer TRAIT_TYPE_ARMOR = 2
constant integer TRAIT_TYPE_SPIKE_ARMOR = 13
constant integer TRAIT_TYPE_STATIC_ARMOR = 13
//Properties
constant integer TRAIT_TYPE_MANA = 10
constant integer TRAIT_TYPE_MANA_REGEN = 11
constant integer TRAIT_TYPE_LIFE = 15
constant integer TRAIT_TYPE_LIFE_REGEN = 16
constant integer TRAIT_TYPE_MOVEMENT_SPEED = 38
//Stats
constant integer TRAIT_TYPE_STRENGTH = 5
constant integer TRAIT_TYPE_AGILITY = 6
constant integer TRAIT_TYPE_INTELLIGENCE = 7
constant integer TRAIT_TYPE_ALL_STATS = 18
//Resistances
constant integer TRAIT_TYPE_FIRE_RESISTANCE = 25
constant integer TRAIT_TYPE_LIGHTNING_RESISTANCE = 26
constant integer TRAIT_TYPE_COLD_RESISTANCE = 27
constant integer TRAIT_TYPE_POISON_RESISTANCE = 28
constant integer TRAIT_TYPE_DARKNESS_RESISTANCE = 29
constant integer TRAIT_TYPE_HOLY_RESISTANCE = 30
constant integer TRAIT_TYPE_PHYSICAL_RESISTANCE = 31
constant integer TRAIT_TYPE_ALL_RESISTANCE = 32
constant integer TRAIT_RESISTANCES = 7
//Crit
constant integer TRAIT_TYPE_CRIT_POW = 33
constant integer TRAIT_TYPE_CRIT_RATE = 34
constant integer TRAIT_TYPE_SPELL_CRIT_POW = 35
constant integer TRAIT_TYPE_SPELL_CRIT_RATE = 36
constant integer TRAIT_CRITS = 4
constant integer TRAIT_AMOUNTS = 38
constant integer TRAIT_REQ_LEVEL = 1
constant integer TRAIT_REQ_WARR = 2
constant integer TRAIT_REQ_WIZ_WITCH = 3
constant integer TRAIT_REQ_AMOUNTS = 3
endglobals
endlibrary
JASS:
library ShowInventory initializer onInittT requires ItemInventory
globals
private real currentX = 0
private real currentY = 0
private real currentAA = 0
private real currentD = 0
private boolean isInInventory = false
private rect lock
endglobals
private function onChat takes nothing returns boolean
if GetLocalPlayer() == GetTriggerPlayer() then
set currentX = GetCameraTargetPositionX()
set currentY = GetCameraTargetPositionY()
set currentAA = GetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK) * bj_RADTODEG
set currentD = GetCameraField(CAMERA_FIELD_TARGET_DISTANCE)
set isInInventory = true
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, 270.00, 0 ) // dont touch
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 2050, 0 ) //change this depending on the size of your talent tree
call PanCameraToTimed(GetRectMaxX(getInventoryRect()) - 340, GetRectMaxY(getInventoryRect()),0) //this is the actual camera pan
call SetCameraBoundsToRect(lock)
// call SetCameraBoundsToRect(regionLock)
endif
return false
endfunction
private function onExit takes nothing returns boolean
if isInInventory and GetLocalPlayer() == GetTriggerPlayer() then
call SetCameraBoundsToRect(bj_mapInitialPlayableArea)
call SetCameraPosition(currentX, currentY)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, currentAA, 0)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, currentD, 0)
set isInInventory = false
endif
return false
endfunction
private function fuc takes nothing returns nothing
call CustomInventory.rects()
call CustomInventory.Initalize()
endfunction
private function onInittT takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t2 = CreateTrigger()
local integer i = 0
call fuc()
set lock = Rect(GetRectMaxX(getInventoryRect()) - 340, GetRectMaxY(getInventoryRect()),GetRectMaxX(getInventoryRect()) - 340, GetRectMaxY(getInventoryRect()))
loop
call TriggerRegisterPlayerChatEvent(t, Player(i), "-inventory", true)
call TriggerRegisterPlayerChatEvent(t2, Player(i), "-exit", true)
set i = i + 1
exitwhen i == 12
endloop
call TriggerAddCondition(t, Filter(function onChat))
call TriggerAddCondition(t2, Filter(function onExit))
set i = 0
set t2 = null
set t = null
endfunction
endlibrary
JASS:
//! textmacro ICI
module ICI_init
private static method onInit takes nothing returns nothing
set opConTitle[0] = "View Set Data"
set opConDesc[0] = "Views the set data for the currently selected item"
set opIds[0] = 'B00Q'
endmethod
endmodule
struct ICI
static string array opConTitle
static string array opConDesc
static integer array opIds
implement ICI_init
public static method applyTraitToUnit takes Trait t, unit u returns nothing
call StatHandler.addUnitBonus(u,t)
endmethod
public static method removeTraitFromUnit takes Trait t, unit u returns nothing
call StatHandler.removeUnitBonus(u,t)
endmethod
public static method getSlotEmptyBackground takes integer slot returns integer
if slot == SLOT_BELT then
return 'B028'
elseif slot == SLOT_HELM then
return 'B022'
elseif slot == SLOT_GLOVE then
return 'B01Y'
elseif slot == SLOT_WING then
return 'B020'
elseif slot == SLOT_MAINHAND then
return 'B00Z'
elseif slot == SLOT_OFFHAND then
return 'B021'
elseif slot == SLOT_RINGLEFT then
return 'B01Z'
elseif slot == SLOT_RINGRIGHT then
return 'B024'
elseif slot == SLOT_BOOTS then
return 'B025'
elseif slot == SLOT_NECKLACE then
return 'B026'
elseif slot == SLOT_PANTS then
return 'B027'
elseif slot == SLOT_ARMOR then
return 'B031'
else
return EMPTY_BAG_SLOT
endif
return 0
endmethod
public static method getTraitDescription takes string color, Trait t returns string
if t.typeOfTrait == TRAIT_TYPE_DAMAGE then
return color+"Damage|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_ARMOR then
return color+"Armor |r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_STATIC_ARMOR then
return color+"Static Armor|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_FIRE_DAMAGE then
return color+"Fire Damage |r: " + I2S(R2I(t.a)) + " - " + I2S(R2I(t.b))
elseif t.typeOfTrait == TRAIT_TYPE_LIGHTNING_DAMAGE then
return color+"Electric Damage |r: 1 - " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_STRENGTH then
return color+"Strength|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_AGILITY then
return color+"Agility |r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_INTELLIGENCE then
return color+"Inteligence |r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_MANA then
return color+"Mana|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_MANA_REGEN then
return color+"Mana Regen |r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_SPIKE_ARMOR then
return color+"Spike Armor |r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_STATIC_DAMAGE then
return color+"Chaos Damage |r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_LIFE then
return color+"Life |r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_LIFE_REGEN then
return color+"Life Regen |r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_ATTACK_SPEED then
return color+"Attack Speed|r: " + I2S(R2I(t.a)) + "%"
elseif t.typeOfTrait == TRAIT_TYPE_ALL_STATS then
return color+"All Stats|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_LIFE_LEECH then
return color+"Life Leech|r: " + I2S(R2I(t.a)) + "%"
elseif t.typeOfTrait == TRAIT_TYPE_ARMOR_REDUCTION then
return color+"On-hit Armor Reduction|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_SPELL_CRIT_RATE then
return color+"Spell Critical Strike Rate|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_CRIT_POW then
return color+"Critical Strike Power|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_CRIT_RATE then
return color+"Critical Strike Rate|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_SPELL_CRIT_POW then
return color+"Spell Critical Strike Power|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_MOVEMENT_SPEED then
return color+"Movement Speed|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_FIRE_RESISTANCE then
return color+"Fire Resistance|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_COLD_RESISTANCE then
return color+"Cold Resistance|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_LIGHTNING_RESISTANCE then
return color+"Lightning Resistance|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_POISON_RESISTANCE then
return color+"Poison Resistance|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_DARKNESS_RESISTANCE then
return color+"Darkness Resistance|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_HOLY_RESISTANCE then
return color+"Holy Resistance|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_PHYSICAL_RESISTANCE then
return color+"Physical Resistance|r: " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_TYPE_ALL_RESISTANCE then
return color+"All Resistance|r: " + I2S(R2I(t.a))
endif
return ""
endmethod
//0 - cannot be in slot
//1 - can be in slot but do not replace the item in slot
//2 - replace item in slot
public static method getItemSlotPriority takes Item i, integer slot returns integer
if i.slot == slot then
return 2
elseif ((i.slot == SLOT_RINGLEFT or i.slot == SLOT_RINGRIGHT) and (slot == SLOT_RINGLEFT or slot == SLOT_RINGRIGHT)) or (i.slot == SLOT_OFFHAND and slot == SLOT_MAINHAND) then
return 1
elseif i.slot == TYPE_RECIPE then
return 3
elseif i.slot == SLOT_OFFHANDONLY and slot == SLOT_OFFHAND then
return 2
else
return 0
endif
endmethod
public static method doesHostFulfillReq takes Trait t, unit host returns boolean
if t.typeOfTrait == TRAIT_REQ_LEVEL then
return GetHeroLevel(host) >= t.a
elseif t.typeOfTrait == TRAIT_REQ_WARR then
return GetUnitTypeId(host) == 'H003'
elseif t.typeOfTrait == TRAIT_REQ_WIZ_WITCH then
return GetUnitTypeId(host) == 'H013' or GetUnitTypeId(host) == 'H005'
endif
return false
endmethod
public static method getReqDescription takes Trait t, string color returns string
if t.typeOfTrait == TRAIT_REQ_LEVEL then
call print("rec:lvl")
return color + "Level Requirement|r : " + I2S(R2I(t.a))
elseif t.typeOfTrait == TRAIT_REQ_WARR then
return color + "Class Requirement|r : Warrior"
elseif t.typeOfTrait == TRAIT_REQ_WIZ_WITCH then
return color + "Class Requirement|r : Runemaster, Witch"
endif
call print("rec:nada:"+I2S(t.typeOfTrait))
return ""
endmethod
public static method onOperatorClick takes Item selected, integer opSlot, player p returns nothing
if opSlot == 1 then
call displaySetData(selected,opSlot,p)
endif
endmethod
public static method getOpConTitle takes integer slot returns string
if opConTitle[slot] == "" or opConTitle[slot] == null then
return "No Function"
endif
return opConTitle[slot]
endmethod
public static method getOpConDesc takes integer slot returns string
return opConDesc[slot]
endmethod
public static method getOpConButton takes integer slto returns integer
if opIds[slto] == 0 then
call print("empty")
return EMPTY_BAG_SLOT
else
call print("bag")
return opIds[slto]
endif
endmethod
private static method displaySetData takes Item it, integer os, player p returns nothing
local integer tempid
local string title
local string desc
if it.setv == 0 then
set title = "No Set Data"
set desc = title
else
set title = "Set Description : " + it.setv.title
set desc = it.setv.desc
endif
if GetLocalPlayer() == p then
set tempid = 'B00I'
else
set tempid = GetDestructableTypeId(lastHoveredIcon)
endif
call RemoveDestructable(lastHoveredIcon)
set lastHoveredIcon = CreateDestructable(tempid, lstX, lstY, 0,1,0)
if lstTTtitle == null then
set lstTTtitle = CreateTextTag()
set lstTTdesc = CreateTextTag()
call SetTextTagPos(lstTTtitle, GetRectMinX(hoverTitleRect), GetRectMinY(hoverTitleRect), 0)
call SetTextTagVisibility(lstTTtitle,true)
call SetTextTagPos(lstTTdesc, GetRectMinX(hoverDescRect), GetRectMinY(hoverDescRect), 0)
call SetTextTagVisibility(lstTTdesc,true)
// else
// call DestroyTextTag(lstTTtitle)
// call DestroyTextTag(lstTTdesc)
// set lstTTtitle = CreateTextTag()
// set lstTTdesc = CreateTextTag()
endif
if GetLocalPlayer() == p then
call SetTextTagTextBJ(lstTTtitle,title , 10)
call SetTextTagTextBJ(lstTTdesc, desc, 10)
endif
endmethod
endstruct
//! endtextmacro
JASS:
library CustomInventoryTraitHandler// requires ItemInventory
struct Trait
integer typeOfTrait
real a
real b
real c
real d
public static method create takes real aV, real bV, real cV, real dV, integer typeOfTraitx returns thistype
local thistype this
set this = thistype.allocate()
set this.a = aV
set this.b = bV
set this.c = cV
set this.d = dV
set this.typeOfTrait = typeOfTraitx
return this
endmethod
public method toString takes nothing returns string
return ICI.getTraitDescription("|cffffcc00", this)
endmethod
endstruct
private struct SpecificTraitGenerator
integer typeOfTrait
real amin
real amax
real aweight
real bmin
real bmax
real bweight
real cmin
real cmax
real cweight
real dmin
real dmax
real dweight
public static method createx takes nothing returns thistype
local thistype this = thistype.allocate()
return this
endmethod
public method setV takes integer typeOT, real aminx, real amaxx, real aweightx returns thistype
set typeOfTrait = typeOT
set amin = aminx
set amax = amaxx
set aweight = aweightx
return this
endmethod
public method setAll takes integer typeOfTraitx, real aminx, real amaxx, real aweightx, real bminx, real bmaxx, real bweightx, real cminx, real cmaxx, real cweightx, real dminx, real dmaxx, real dweightx returns nothing
set this.typeOfTrait = typeOfTraitx
set this.amin = aminx
set this.amax = amaxx
set this.aweight = aweightx
set this.bmin = bminx
set this.bmax = bmaxx
set this.bweight = bweightx
set this.cmin = cminx
set this.cmax = cmaxx
set this.cweight = cweightx
set this.dmin = dminx
set this.dmax = dmaxx
set this.dweight = dweightx
endmethod
public static method create takes integer typeOfTraitx, real aminx, real amaxx, real aweightx, real bminx, real bmaxx, real bweightx, real cminx, real cmaxx, real cweightx, real dminx, real dmaxx, real dweightx returns thistype
local thistype this = thistype.allocate()
set this.typeOfTrait = typeOfTraitx
set this.amin = aminx
set this.amax = amaxx
set this.aweight = aweightx
set this.bmin = bminx
set this.bmax = bmaxx
set this.bweight = bweightx
set this.cmin = cminx
set this.cmax = cmaxx
set this.cweight = cweightx
set this.dmin = dminx
set this.dmax = dmaxx
set this.dweight = dweightx
return this
endmethod
private method d takes real min, real max, real weight returns real
local real temp1 = 0
local real temp2 = 0
local real temp3 = 0
local real debugv
if min == 0 and max == 0 then
return 0.
endif
if weight != 0 then
if weight < 0 then
call BJDebugMsg("ERROR INVALID WEIGHT IN TRAIT SYSTEM")
return 0./0.
else
set temp1 = GetRandomReal(min,max)
set temp3 = GetRandomReal(min,temp1)
set debugv = temp1 - ((temp1-temp3)*((100-(100/(Pow(2,(weight/3)))))/100))
return debugv
endif
endif
return GetRandomReal(min,max)
endmethod
public method generate takes nothing returns Trait
local real av = 0
local real bv = 0
local real cv = 0
local real dv = 0
//! textmacro GENERATE_RUN takes LETTER_PREFIX
if $LETTER_PREFIX$min != 0 and $LETTER_PREFIX$max != 0 then
set $LETTER_PREFIX$v = d($LETTER_PREFIX$min, $LETTER_PREFIX$max, $LETTER_PREFIX$weight)
else
set $LETTER_PREFIX$v = 0
endif
//! endtextmacro
//! runtextmacro GENERATE_RUN("a")
//! runtextmacro GENERATE_RUN("b")
//! runtextmacro GENERATE_RUN("c")
//! runtextmacro GENERATE_RUN("d")
return Trait.create(av,bv,cv,dv,typeOfTrait)
endmethod
endstruct
private struct TraitGroup
TableArray holder
integer maxHolder
integer combinedWeights
public static method create takes nothing returns thistype
local thistype this = thistype.allocate()
set holder = TableArray[3]
set maxHolder = 0
set combinedWeights = 0
return this
endmethod
public method add takes integer typeOfTraitx, real aminx, real amaxx, real aweightx, real bminx, real bmaxx, real bweightx, /*
*/ real cminx, real cmaxx, real cweightx, real dminx, real dmaxx, real dweightx, integer traitWeight returns nothing
local SpecificTraitGenerator t = SpecificTraitGenerator.create(typeOfTraitx,aminx,amaxx,aweightx,bminx,bmaxx,bweightx,cminx,cmaxx,cweightx,dminx,dmaxx,dweightx)
set holder[1][maxHolder] = combinedWeights
set combinedWeights = combinedWeights + traitWeight
set holder[0][maxHolder] = integer(t)
set maxHolder = maxHolder + 1
endmethod
public method addA takes integer typeOfTraitx, real aminx, real amaxx, real aweightx, integer traitWeight returns nothing
local SpecificTraitGenerator t = SpecificTraitGenerator.create(typeOfTraitx,aminx,amaxx,aweightx,0,0,0,0,0,0,0,0,0)
set holder[1][maxHolder] = combinedWeights
set combinedWeights = combinedWeights + traitWeight
set holder[0][maxHolder] = integer(t)
set maxHolder = maxHolder + 1
endmethod
public method generate takes nothing returns Trait
local integer i = 0
local integer prev = 0
local integer r = GetRandomInt(0, combinedWeights)
if r == 0 then
return SpecificTraitGenerator(holder[0][0]).generate()
else
loop
if integer(holder[1][i]) > r then
return SpecificTraitGenerator(holder[0][i-1]).generate()
endif
set i = i + 1
exitwhen i == maxHolder
endloop
return SpecificTraitGenerator(holder[0][i-1]).generate()
endif
return 0
endmethod
endstruct
private struct ItemGenerator
TableArray holder
integer maxHolder
public static method create takes nothing returns thistype
local thistype this = thistype.allocate()
set holder = TableArray[4]
set maxHolder = 0
return this
endmethod
public method addTrait takes SpecificTraitGenerator t returns nothing
set holder[0][maxHolder] = integer(t)
set maxHolder = maxHolder + 1
endmethod
public method addGroup takes TraitGroup t returns nothing
set holder[1][maxHolder] = integer(t)
set maxHolder = maxHolder + 1
endmethod
public method addTraits takes Trait t returns nothing
set holder[2][maxHolder] = integer(t)
set maxHolder = maxHolder + 1
endmethod
public method addReq takes Trait t returns nothing
set holder[3][maxHolder] = integer(t)
set maxHolder = maxHolder + 1
endmethod
public method apply takes Item i2 returns nothing
local integer i = 0
if holder[0][0] != 0 or holder[1][0] != null then
loop
if holder[0][i] != 0 then
call i2.addTrait(SpecificTraitGenerator(holder[0][i]).generate())
elseif holder[1][i] != 0 then
call i2.addTrait(TraitGroup(holder[1][i]).generate())
elseif holder[2][i] != 0 then
call i2.addTrait(Trait(holder[2][i]))
elseif holder[3][i] != 0 then
call print("adding a trait with type"+I2S(Trait(holder[3][i]).typeOfTrait))
call i2.addReq(Trait(holder[3][i]))
else
return
endif
set i = i + 1
endloop
endif
endmethod
endstruct
struct FullItemGenerator
ItemGenerator i
string title
string desc
integer destructableId
integer slot
Set setv
Table recipes
integer recIndex
TraitGroup openGroup
static string beta = ""
integer registerId
public static method create takes string title2, string desc2, integer destructableId2, integer slot2 returns thistype
local thistype this = thistype.allocate()
set this.i = ItemGenerator.create()
set this.title = title2
set this.desc = desc2
set this.destructableId = destructableId2
set this.slot = slot2
set this.setv = 0
set this.recipes = Table.create()
set this.recIndex = 0
set this.openGroup = TraitGroup.create()
set this.registerId = 0
return this
endmethod
public method addSingleChangingTrait takes integer typ, integer low, integer high, integer weight returns thistype
call i.addTrait(SpecificTraitGenerator.createx().setV(typ,low,high,weight))
return this
endmethod
public method addSCT takes integer typ, integer low, integer high, integer weight returns thistype
return addSingleChangingTrait(typ,low,high,weight)
endmethod
public method closeGroup takes nothing returns thistype
call i.addGroup(openGroup)
set openGroup = TraitGroup.create()
return this
endmethod
public method addGroupChangingTrait takes integer typ, integer low, integer high, integer weight, integer grpWeight returns thistype
call openGroup.addA(typ,low,high,weight,grpWeight)
return this
endmethod
public method addGCT takes integer typ, integer low, integer high, integer weight, integer grpWeight returns thistype
return addGroupChangingTrait(typ, low,high,weight,grpWeight)
endmethod
public method addStaticTrait takes integer typ, integer val returns thistype
call i.addTraits(Trait.create(val,0,0,0,typ))
return this
endmethod
public method addSet takes Set s returns thistype
set setv = s
if registerId != 0 then
call s.addItem(registerId)
endif
return this
endmethod
public method register takes integer itemId returns thistype
call CustomInventory.register(this,itemId)
set registerId = itemId
if setv != 0 then
call setv.addItem(itemId)
endif
return this
endmethod
public method addRecipe takes Recipe2 s returns thistype
set recipes[recIndex] = s
set recIndex = recIndex + 1
return this
endmethod
public method addNewRecipe takes nothing returns Recipe2
local Recipe2 r
set r = Recipe2.create()
call addRecipe(r)
return r
endmethod
public method addReq takes integer typ, integer val returns thistype
call i.addReq(Trait.create(val,0,0,0,typ))
return this
endmethod
public method generate takes item i2 returns nothing
local integer looper = 0
local Item ite
call CustomInventory.linkItemTraitData(destructableId, slot, title, desc, i2)
set ite = CustomInventory.getItemTraitData(i2)
call i.apply(ite)
if recipes[0] != 0 then
set looper = 0
loop
exitwhen recipes[looper] == 0
call ite.addRecipe(recipes[looper])
set looper = looper + 1
endloop
endif
if setv != 0 then
call ite.addSet(setv)
endif
endmethod
endstruct
endlibrary
JASS:
//! textmacro RECIPE
struct RecipeGroup
private Table recipes
private integer recIndex
public static method create takes nothing returns RecipeGroup
local thistype this = thistype.allocate()
set recipes = Table.create()
set recIndex = 0
return this
endmethod
public method add takes Recipe2 rec returns nothing
set recipes[recIndex] = rec
set recIndex = recIndex + 1
endmethod
public method check takes unit u, InventoryButton root returns nothing
local integer i = 0
local Recipe2 r
loop
exitwhen recipes[i] == 0
set r = recipes[i]
if r.check(u,root,this) then
return
endif
set i = i + 1
endloop
call DisplayTimedTextToPlayer(GetOwningPlayer(u), 0,0, 30, "|cffffcc00Notification|r : No completable recipes for this item have been found")
endmethod
endstruct
struct Recipe2
TableArray pieces
Table results
Table piecesCount
integer resultsCount
string temp
static string total = ""
public static method create takes nothing returns thistype
local thistype this = thistype.allocate()
set pieces = TableArray[10]
set results = Table.create()
set piecesCount = Table.create()
set resultsCount = 0
return this
endmethod
public method setSlots takes integer number returns nothing
call pieces.destroy()
set pieces = TableArray[number]
endmethod
public method addPiece takes integer slot, integer itemId returns thistype
set pieces[slot][piecesCount[slot]] = itemId
set piecesCount[slot] = piecesCount[slot]+1
return this
endmethod
public method addResult takes integer itemId returns thistype
set results[resultsCount] = itemId
set resultsCount = resultsCount+1
return this
endmethod
public method check2 takes unit u, InventoryButton root returns nothing
endmethod
public method check takes unit u, InventoryButton root, RecipeGroup g returns boolean
local TableArray t
local integer i = 0
local integer array usedPieces
local integer usedPiecesCount = 0
local integer i2 = 0
local integer temp
local integer temp2
set t = CustomInventory.gather(u)
loop
exitwhen pieces[i][0] == 0
set i2 = 0
loop
set temp2 = pieces[i][i2]
exitwhen temp2 == 0
set temp = t[0][temp2]
if temp != 0 then
set t[0][temp2] = temp - 1
set usedPieces[usedPiecesCount] = t[1][temp2]
set usedPiecesCount = usedPiecesCount + 1
exitwhen true
endif
set i2 = i2 + 1
endloop
if usedPiecesCount == i then
call t.destroy()
return false
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen usedPieces[i] == 0
call InventoryGrouping(usedPieces[i]).reset(u)
set i = i + 1
endloop
call root.reset(u)
set i = 0
loop
exitwhen results[i] == 0
call CustomInventory.generateNewItem(CreateItem(results[i],0,0), u)
set i = i + 1
endloop
call t.destroy()
return true
endmethod
endstruct
//! endtextmacro
Attachments
Last edited: