Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function serverCmdBBBR_RequestShopData(%client)
- {
- %BBB = BBB_System;
- for(%i = 0; %i < %BBB.totalEquipment; %i++)
- {
- %itemData = %BBB.equipmentList[%i]; //Just dump onto em all the new information they could ever want.
- if(%client.player.role $= %itemData.alliance)
- commandToClient(%client,'BBBR_ReceiveShopData',%itemData.id,%itemData.color);
- }
- }
- function GameConnection::ShopMessage(%client,%msg) //Rather not copy paste this code everywhere. again.
- {
- %client.chatMessage("\c4Shop\c6:" SPC %msg);
- }
- function serverCmdBBBRShop(%client,%id,%confirm)
- {
- if(isObject(%player = %client.player))
- {
- %BBB = BBB_System;
- if(%id $= "") //Give a list to the poor children who cannot afford a free GUI
- {
- %client.ShopMessage("You may purchase the following equipment as a(n)" SPC %player.getFormattedRole() @ "\c6:");
- %total = 0;
- for(%i = 0; %i<%BBB.totalEquipment; %i++)
- {
- %item = BBB_System.equipmentList[%i];
- if(%item.alliance $= %player.role)
- {
- %total ++;
- %assembleMessage = "\c7[\c4"@%item.id@"\c7]"; //Sets up id...
- %assembleMessage = %assembleMessage @ BBB_System.RoleColor[%player.role] SPC %item.name; //Sets the name allong with color...
- %assembleMessage = %assembleMessage SPC "\c6-" SPC %item.desc; //And adds a description. Yay.
- %client.ShopMessage(%assembleMessage);
- }
- }
- if(%total == 0)
- %client.ShopMessage("You can get nothing! Good day sir!");
- else
- %client.ShopMessage("Type \"/BBBRShop \c4TheIdLocatedInCyan\c6 Yes\" in chat to confirm your purchase.");
- }
- else if(%confirm $= "Yes") //Great scott they've actually purchased it!
- {
- serverCmdBBBR_ProcessShopRequest(%client,%id,false,true);
- }
- }
- else
- %client.ShopMessage("\c0ERROR: Ghosts do not possess enough real limbs to handle the current wares for sale.");
- }
- function serverCmdBBBR_ProcessShopRequest(%client,%id,%check,%skipCustoms)
- {
- if(isObject(%player = %client.player)) //We don't want to operate on something that's dead...
- {
- %itemData = BBB_System.equipmentListById[%id]; //Pulls out item data for use.
- if(!isObject(%itemData))
- %client.ShopMessage("\c0ERROR: The equipment you are trying to purchase doesn't exist.");
- if((%player.prevItemId $= %id && !%check) || %skipCustoms)
- {
- if(%player.credits >= %itemData.cost)
- {
- if(%player.role $= %itemData.alliance)
- {
- %brokenTwig = false;
- for(%i = 0; %i < %player.purchasedEquipment; %i++)
- {
- %word = getWord(%player.equipmentList,%i);
- if(getWord(%player.equipmentList,%i) $= %id)
- %brokenTwig = true;
- }
- if(!%brokenTwig)
- {
- if(%itemData.type $= "Item")
- {
- if(%player.tool[%itemData.slot] == 0)
- {
- %item = %itemData.data;
- %client.player.tool[%itemData.slot] = nameToID(%item);
- messageClient(%client,'MsgItemPickup','',%itemData.slot,nameToID(%item));
- }
- else
- {
- %client.ShopMessage("\c0ERROR: There is no space for this equipment in slot #" @ (%itemData.slot + 1) SPC ".");
- return;
- }
- }
- else
- %client.call(%itemData.data);
- if(%itemData.buyOnce)
- {
- commandToClient(%client,'BBBR_disableButton',%itemData.id);
- if(%player.equipmentList $= "")
- %player.equipmentList = %itemData.id;
- else
- %player.equipmentList = %player.equipmentList SPC %id;
- %player.purchasedEquipment ++;
- }
- %player.credits -= %itemData.cost;
- }
- else
- %client.ShopMessage("\c0ERROR: You've already purchased this and cannot purchase it again.");
- }
- else
- %client.ShopMessage("\c0ERROR: This equipment is not available for you!");
- }
- else
- %client.ShopMessage("\c0ERROR: Not enough credits.");
- }
- else
- {
- %player.prevItemId = %id;
- commandToClient(%client,'BBBR_RecieveItemData',%itemData.name,%itemData.desc);
- }
- }
- else
- %client.ShopMessage("\c0ERROR: You don't even exist. Idiot.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement