Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function addItem(temp.itemName, temp.qty)
- {
- temp.caller = getCallStack()[1];
- temp.logPath = "rpg/" @ this.subDir @ this.id @ "/addLog.log";
- temp.logText = "Added " @ temp.qty @ " " @ temp.itemName @ "(s) to player.";
- savelog2(temp.logPath, temp.logText);
- for(temp.i = 0; temp.i < this.items.size(); temp.i ++)
- {
- if(this.items[temp.i][0] == temp.itemName)
- {
- this.items[temp.i][1] += temp.qty;
- this.reflectItems();
- return;
- }
- }
- this.items.add({temp.itemName, temp.qty});
- this.reflectItems();
- }
- public function removeItem(temp.itemName, temp.qty)
- {
- temp.caller = getCallStack()[1];
- temp.logPath = "rpg/" @ this.subDir @ this.id @ "/removeLog.log";
- temp.logText = "Removed " @ temp.qty @ " " @ temp.itemName @ "(s) from player.";
- savelog2(temp.logPath, temp.logText);
- for(temp.i = 0; temp.i < this.items.size(); temp.i ++)
- {
- if(this.items[temp.i][0] == temp.itemName)
- {
- if(this.items[temp.i][1] - temp.qty > 0)
- {
- this.items[temp.i][1] -= temp.qty;
- }
- else
- {
- this.items.delete(temp.i);
- }
- this.reflectItems();
- return;
- }
- }
- }
- public function equipItem(temp.itemName)
- {
- for(temp.item: this.items)
- {
- if(temp.item[0] == temp.itemName)
- {
- temp.itemObj = makevar("item_" @ temp.item[0]);
- switch(temp.itemObj.catagory)
- {
- case "Weapons":
- return({temp.itemObj.speed, temp.itemObj.power, temp.itemObj.image, temp.itemObj.gani, temp.itemObj.displayName, temp.itemObj.itemType, temp.itemObj.arrowImage, temp.itemObj.arrowsShot});
- break;
- case "Instruments":
- return({0.5, 0, temp.itemObj.image, temp.itemObj.gani, temp.itemObj.displayName, 7, null, null});
- break;
- case "Tools":
- return({0.5, 0, temp.itemObj.image, temp.itemObj.gani, temp.itemObj.displayName, 7, null, null});
- break;
- case "Armor":
- return({temp.itemObj.iconImage, temp.itemObj.armorSlot, temp.itemObj.dmgPlus, temp.itemObj.defPlus, temp.itemObj.hpPlus, temp.itemObj.mpPlus, temp.itemObj.displayName, temp.itemObj.levelReq});
- break;
- case "Items":
- return({temp.itemObj.iconImage, temp.itemObj.armorSlot, temp.itemObj.dmgPlus, temp.itemObj.defPlus, temp.itemObj.hpPlus, temp.itemObj.mpPlus, temp.itemObj.displayName, temp.itemObj.levelReq});
- break;
- }
- }
- }
- return({ 0.35, 1.0, "end_punch.png", "end_punch_", "Weapons/Punch", NULL});
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement