Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "../../../ZoneClientSession.h"
- #include "../../player/Player.h"
- #include "../../../packets.h"
- #include "JediRobe.idl"
- #include "JediRobeImplementation.h
- #include "../../../managers/player/PlayerManager.h"
- JediRobeImplementation::JediRobeImplementation(uint64 objid, uint32 tempCRC,
- const UnicodeString& n, const String& tempn, bool eqp) :
- JediRobeServant(objid, tempCRC, n, tempn, eqp) {
- init();
- }
- JediRobeImplementation::JediRobeImplementation(CreatureObject* creature,
- uint32 tempCRC, const UnicodeString& n, const String& tempn, bool eqp) :
- JediRobeServant(creature, tempCRC, n, tempn, eqp) {
- //objectCRC = String::hashCode(temp);
- customName = n;
- stfName = tempn;
- init();
- }
- void JediRobeImplementation::parseItemAttributes() {
- WearableImplementation::parseItemAttributes();
- name = "force regen bonus";
- forceRegenBonus = itemAttributes->getFloatAttribute(name);
- name = "max force power bonus";
- maxForcePowerBonus = itemAttributes->getFloatAttribute(name);
- String temp;
- }
- wearableType = WearableImplementation::WEARABLE;
- }
- void JediRobeImplementation::init() {
- objectSubType = ARMOR;
- setCondition(100, 100);
- setKinetic(0.0f);
- setEnergy(0.0f);
- StringBuffer loggingname;
- loggingname << "JediRobe = 0x" << objectID;
- setLoggingName(loggingname.toString());
- setLogging(false);
- setGlobalLogging(true);
- }
- void JediRobeImplementation::sendTo(Player* player, bool doClose) {
- ZoneClientSession* client = player->getClient();
- if (client == NULL)
- return;
- SceneObjectImplementation::create(client);
- if (parent != NULL)
- link(client, parent);
- BaseMessage* tano3 = new TangibleObjectMessage3((TangibleObject*) _this);
- client->sendMessage(tano3);
- if (doClose)
- SceneObjectImplementation::close(client);
- }
- //TODO:Cell permission check
- if (_this->getParent() != NULL) {
- bool cellPermission = true;
- if (_this->getParent()->isCell() && cellPermission) {
- omr->addRadialParent(10, 3, "@ui_radial:item_pickup");
- }
- }
- omr->finish();
- player->sendMessage(omr);
- }
- void ArmorImplementation::generateAttributes(SceneObject* obj) {
- if (!obj->isPlayer())
- return;
- Player* player = (Player*) obj;
- AttributeListMessage* alm =
- new AttributeListMessage((TangibleObject*) _this);
- addAttributes(alm);
- player->sendMessage(alm);
- }
- void ArmorImplementation::addAttributes(AttributeListMessage* alm) {
- StringBuffer conditionStr;
- conditionStr << getCondition() << '/' << maxCondition;
- alm->insertAttribute("Condition", conditionStr);
- alm->insertAttribute("Volume", "1");
- //alm->insertAttribute("Rank Required", rankRequired);
- alm->insertAttribute("Force Regen Bonus", forceRegenBonus);
- alm->insertAttribute("Max Force Power Bonus", maxForcePowerBonus);
- insertStatMods(alm);
- }
- //Event Handlers
- //Actions
- void JediRobeImplementation::onEquip(Player* player) {
- WearableImplementation::onEquip(player);
- player->setArmorEncumbrance(_this, false);
- }
- void JediRobeImplementation::onUnequip(Player* player) {
- WearableImplementation::onUnequip(player);
- player->unsetArmorEncumbrance(_this);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement