Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.14 KB | None | 0 0
  1.  
  2. #include "../../../ZoneClientSession.h"
  3. #include "../../player/Player.h"
  4.  
  5. #include "../../../packets.h"
  6.  
  7. #include "JediRobe.idl"
  8. #include "JediRobeImplementation.h
  9.  
  10. #include "../../../managers/player/PlayerManager.h"
  11.  
  12. JediRobeImplementation::JediRobeImplementation(uint64 objid, uint32 tempCRC,
  13.         const UnicodeString& n, const String& tempn, bool eqp) :
  14.     JediRobeServant(objid, tempCRC, n, tempn, eqp) {
  15.     init();
  16. }
  17.  
  18. JediRobeImplementation::JediRobeImplementation(CreatureObject* creature,
  19.         uint32 tempCRC, const UnicodeString& n, const String& tempn, bool eqp) :
  20.     JediRobeServant(creature, tempCRC, n, tempn, eqp) {
  21.  
  22.     //objectCRC = String::hashCode(temp);
  23.     customName = n;
  24.     stfName = tempn;
  25.  
  26.     init();
  27. }
  28.  
  29. void JediRobeImplementation::parseItemAttributes() {
  30.  
  31.     WearableImplementation::parseItemAttributes();
  32.  
  33.     name = "force regen bonus";
  34.     forceRegenBonus = itemAttributes->getFloatAttribute(name);
  35.    
  36.     name = "max force power bonus";
  37.     maxForcePowerBonus = itemAttributes->getFloatAttribute(name);
  38.  
  39.     String temp;
  40.  
  41.     }
  42.     wearableType = WearableImplementation::WEARABLE;
  43. }
  44.  
  45. void JediRobeImplementation::init() {
  46.     objectSubType = ARMOR;
  47.    
  48.     setCondition(100, 100);
  49.  
  50.     setKinetic(0.0f);
  51.     setEnergy(0.0f);
  52.  
  53.     StringBuffer loggingname;
  54.     loggingname << "JediRobe = 0x" << objectID;
  55.     setLoggingName(loggingname.toString());
  56.  
  57.     setLogging(false);
  58.     setGlobalLogging(true);
  59. }
  60.  
  61. void JediRobeImplementation::sendTo(Player* player, bool doClose) {
  62.     ZoneClientSession* client = player->getClient();
  63.     if (client == NULL)
  64.         return;
  65.  
  66.     SceneObjectImplementation::create(client);
  67.  
  68.     if (parent != NULL)
  69.         link(client, parent);
  70.  
  71.     BaseMessage* tano3 = new TangibleObjectMessage3((TangibleObject*) _this);
  72.     client->sendMessage(tano3);
  73.  
  74.     if (doClose)
  75.         SceneObjectImplementation::close(client);
  76.  
  77. }
  78.  
  79.     //TODO:Cell permission check
  80.     if (_this->getParent() != NULL) {
  81.         bool cellPermission = true;
  82.  
  83.         if (_this->getParent()->isCell() && cellPermission) {
  84.             omr->addRadialParent(10, 3, "@ui_radial:item_pickup");
  85.         }
  86.     }
  87.  
  88.     omr->finish();
  89.     player->sendMessage(omr);
  90. }
  91.  
  92. void ArmorImplementation::generateAttributes(SceneObject* obj) {
  93.     if (!obj->isPlayer())
  94.         return;
  95.  
  96.     Player* player = (Player*) obj;
  97.  
  98.     AttributeListMessage* alm =
  99.             new AttributeListMessage((TangibleObject*) _this);
  100.  
  101.     addAttributes(alm);
  102.  
  103.     player->sendMessage(alm);
  104.  
  105. }
  106.  
  107. void ArmorImplementation::addAttributes(AttributeListMessage* alm) {
  108.     StringBuffer conditionStr;
  109.     conditionStr << getCondition() << '/' << maxCondition;
  110.     alm->insertAttribute("Condition", conditionStr);
  111.  
  112.     alm->insertAttribute("Volume", "1");
  113.    
  114.     //alm->insertAttribute("Rank Required", rankRequired);
  115.    
  116.     alm->insertAttribute("Force Regen Bonus", forceRegenBonus);
  117.  
  118.     alm->insertAttribute("Max Force Power Bonus", maxForcePowerBonus);
  119.  
  120.     insertStatMods(alm);
  121. }
  122.  
  123. //Event Handlers
  124.  
  125. //Actions
  126.  
  127. void JediRobeImplementation::onEquip(Player* player) {
  128.  
  129.     WearableImplementation::onEquip(player);
  130.  
  131.     player->setArmorEncumbrance(_this, false);
  132.  
  133. }
  134. void JediRobeImplementation::onUnequip(Player* player) {
  135.  
  136.     WearableImplementation::onUnequip(player);
  137.  
  138.     player->unsetArmorEncumbrance(_this);
  139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement