Instructions Jenkins Doxygen

[Added] /gallop command (duration, speed, and cooldown is placeholder. 53/1353/2
authorIvojedi <ivojedi@swgemu.com>
Thu, 30 Jan 2014 20:13:54 +0000 (12:13 -0800)
committerIvojedi <ivojedi@swgemu.com>
Thu, 30 Jan 2014 20:13:54 +0000 (12:13 -0800)
Creature specific values will be added and used later.)
[Added] /gallopstop command

Change-Id: I07bff3af6f7ce369b21fa37dbba0d843443ee723

MMOCoreORB/src/server/zone/objects/creature/buffs/Buff.idl
MMOCoreORB/src/server/zone/objects/creature/commands/BurstRunCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/DismountCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/GallopCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/GallopStopCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/MountCommand.h
MMOCoreORB/src/server/zone/objects/creature/events/GallopNotifyAvailableEvent.h [new file with mode: 0644]

index ba8a35d..6ab6ae9 100644 (file)
@@ -197,6 +197,20 @@ class Buff extends ManagedObject implements Logger {
                setSkillModifier("private_acceleration_multiplier", multiplier * 100);
        }
 
+       public float getSpeedMultiplierMod() {
+               int speed = getSkillModifierValue("private_speed_multiplier");
+               float multiplier = speed / 100.0;
+
+               return multiplier;
+       }
+
+       public float getAccelerationMultiplierMod() {
+               int acceleration = getSkillModifierValue("private_acceleration_multiplier");
+               float multiplier = acceleration / 100.0;
+
+               return multiplier;
+       }
+
        public void setFillAttributesOnBuff(boolean val) {
                fillAttributesOnBuff = val;
        }
index eab4eb4..3aa090d 100755 (executable)
@@ -109,6 +109,11 @@ public:
                        return GENERALERROR;
                }
 
+               if (creature->hasBuff(String("gallop").hashCode())) {
+                       creature->sendSystemMessage("You cannot burst run while gallop is active.");
+                       return GENERALERROR;
+               }
+
                float burstRunMod = (float) creature->getSkillMod("burst_run");
 
                if (burstRunMod > 100.0f) {
index c9f0df8..2656c67 100755 (executable)
@@ -120,6 +120,31 @@ public:
                        creature->setAccelerationMultiplierMod(1.f);
                }
 
+               unsigned int crc = String("gallop").hashCode();
+               if (creature->hasBuff(crc)) {
+                       ManagedReference<Buff*> buff = creature->getBuff(crc);
+
+                       if (buff != NULL) {
+                               //Negate effect of the active gallop buff. The negation will be cleared automatically when the buff is deactivated.
+                               creature->setSpeedMultiplierMod(1.f / buff->getSpeedMultiplierMod());
+                               creature->setAccelerationMultiplierMod(1.f / buff->getAccelerationMultiplierMod());
+                       }
+               }
+
+               Locker vehicleLocker(vehicle, creature);
+
+               if (vehicle->hasBuff(crc)) {
+                       ManagedReference<Buff*> buff = creature->getBuff(crc);
+
+                       if (buff != NULL) {
+                               //Negate effect of the active gallop buff. The negation will be cleared automatically when the buff is deactivated.
+                               vehicle->setSpeedMultiplierMod(1.f / buff->getSpeedMultiplierMod());
+                               vehicle->setAccelerationMultiplierMod(1.f / buff->getAccelerationMultiplierMod());
+                       }
+               }
+
+               vehicleLocker.release();
+
                creature->clearState(CreatureState::RIDINGMOUNT);
 
                SpeedMultiplierModChanges* changeBuffer = creature->getSpeedMultiplierModChanges();
index b25c0ee..c678653 100755 (executable)
@@ -46,6 +46,8 @@ which carries forward this exception.
 #define GALLOPCOMMAND_H_
 
 #include "server/zone/objects/scene/SceneObject.h"
+#include "server/zone/objects/creature/buffs/Buff.h"
+#include "server/zone/objects/creature/events/GallopNotifyAvailableEvent.h"
 
 class GallopCommand : public QueueCommand {
 public:
@@ -63,6 +65,62 @@ public:
                if (!checkInvalidLocomotions(creature))
                        return INVALIDLOCOMOTION;
 
+               ManagedReference<SceneObject*> parent = creature->getParent().get();
+
+               if (parent == NULL || !parent->isMount()) {
+                       creature->sendSystemMessage("@combat_effects:not_mounted"); // You cannot perform this command without a mount.
+                       return GENERALERROR;
+               }
+
+               ManagedReference<CreatureObject*> mount = cast<CreatureObject*>(parent.get());
+               if (mount == NULL)
+                       return GENERALERROR;
+
+               Locker crossLocker(mount, creature);
+
+               uint32 crc = String("gallop").hashCode();
+
+               if (mount->hasBuff(crc) || creature->hasBuff(crc)) {
+                       return GENERALERROR;
+               }
+
+               if (!creature->checkCooldownRecovery("gallop")) {
+                       creature->sendSystemMessage("@combat_effects:mount_tired"); // Your mount is too tired to gallop.
+                       return GENERALERROR;
+               }
+
+               if (creature->hasBuff(String("burstrun").hashCode())) {
+                       creature->sendSystemMessage("You cannot gallop while burst run is active.");
+                       return GENERALERROR;
+               }
+
+               StringIdChatParameter startStringId("combat_effects", "gallop_start"); // Your mount runs as fast as it can.
+               StringIdChatParameter endStringId("combat_effects", "gallop_stop"); // Your mount is winded and slows down.
+
+               //TODO: Get correct durations, magnitudes, and cooldowns for gallop buff
+               int duration = 30;
+               float magnitude = 1.822f;
+               int cooldown = 300;
+
+               ManagedReference<Buff*> buff = new Buff(mount, crc, duration, BuffType::SKILL);
+               buff->setSpeedMultiplierMod(magnitude);
+               buff->setAccelerationMultiplierMod(magnitude);
+
+               mount->addBuff(buff);
+
+               ManagedReference<Buff*> buff2 = new Buff(creature, crc, duration, BuffType::SKILL);
+               buff2->setSpeedMultiplierMod(magnitude);
+               buff2->setAccelerationMultiplierMod(magnitude);
+               buff2->setStartMessage(startStringId);
+               buff2->setEndMessage(endStringId);
+
+               creature->addBuff(buff2);
+
+               creature->updateCooldownTimer("gallop", (cooldown + duration) * 1000);
+
+               Reference<GallopNotifyAvailableEvent*> task = new GallopNotifyAvailableEvent(creature);
+               creature->addPendingTask("gallop_notify", task, (cooldown + duration) * 1000);
+
                return SUCCESS;
        }
 
index 81b920a..c1f6847 100755 (executable)
@@ -63,6 +63,44 @@ public:
                if (!checkInvalidLocomotions(creature))
                        return INVALIDLOCOMOTION;
 
+               ManagedReference<SceneObject*> parent = creature->getParent().get();
+
+               if (parent == NULL || !parent->isMount()) {
+                       creature->sendSystemMessage("@combat_effects:cant_stop_gallop_not_mounted"); // You can't stop galloping if you aren't mounted.
+                       return GENERALERROR;
+               }
+
+               ManagedReference<CreatureObject*> mount = cast<CreatureObject*>(parent.get());
+               if (mount == NULL)
+                       return GENERALERROR;
+
+               Locker crossLocker(mount, creature);
+
+               uint32 crc = String("gallop").hashCode();
+
+               if (!creature->hasBuff(crc)) {
+                       if (mount->hasBuff(crc))
+                               mount->removeBuff(crc);
+
+                       creature->sendSystemMessage("@combat_effects:cant_stop_galloping_not_galloping"); // You can't stop galloping if you aren't already galloping.
+                       return GENERALERROR;
+               } else if (!mount->hasBuff(crc)) {
+                       creature->removeBuff(crc);
+
+                       return GENERALERROR;
+               }
+
+               //TODO: get correct cooldowns
+               int cooldown = 300;
+
+               creature->removeBuff(crc);
+               mount->removeBuff(crc);
+               creature->getCooldownTimerMap()->updateToCurrentAndAddMili("gallop", cooldown * 1000);
+               creature->removePendingTask("gallop_notify");
+
+               Reference<GallopNotifyAvailableEvent*> task = new GallopNotifyAvailableEvent(creature);
+               creature->addPendingTask("gallop_notify", task, cooldown * 1000);
+
                return SUCCESS;
        }
 
index d099373..8dad8be 100755 (executable)
@@ -111,6 +111,18 @@ public:
                        if (!vehicle->transferObject(creature, 4, true))
                                vehicle->error("could not add creature");
 
+                       if (creature->hasBuff(String("gallop").hashCode())) {
+                               //Clear the active negation of the gallop buff.
+                               creature->setSpeedMultiplierMod(1.f);
+                               creature->setAccelerationMultiplierMod(1.f);
+                       }
+
+                       if (vehicle->hasBuff(String("gallop").hashCode())) {
+                               //Clear the active negation of the gallop buff.
+                               vehicle->setSpeedMultiplierMod(1.f);
+                               vehicle->setAccelerationMultiplierMod(1.f);
+                       }
+
                        if (creature->hasBuff(String("burstrun").hashCode())
                                        || creature->hasBuff(String("retreat").hashCode())) {
                                //Negate effect of the active burst run or retreat buff. The negation will be cleared automatically when the buff is deactivated.
diff --git a/MMOCoreORB/src/server/zone/objects/creature/events/GallopNotifyAvailableEvent.h b/MMOCoreORB/src/server/zone/objects/creature/events/GallopNotifyAvailableEvent.h
new file mode 100644 (file)
index 0000000..994124f
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+Copyright (C) 2007 <SWGEmu>
+
+This File is part of Core3.
+
+This program is free software; you can redistribute
+it and/or modify it under the terms of the GNU Lesser
+General Public License as published by the Free Software
+Foundation; either version 2 of the License,
+or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General
+Public License along with this program; if not, write to
+the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Linking Engine3 statically or dynamically with other modules
+is making a combined work based on Engine3.
+Thus, the terms and conditions of the GNU Lesser General Public License
+cover the whole combination.
+
+In addition, as a special exception, the copyright holders of Engine3
+give you permission to combine Engine3 program with free software
+programs or libraries that are released under the GNU LGPL and with
+code included in the standard release of Core3 under the GNU LGPL
+license (or modified versions of such code, with unchanged license).
+You may copy and distribute such a system following the terms of the
+GNU LGPL for Engine3 and the licenses of the other code concerned,
+provided that you include the source code of that other code when
+and as the GNU LGPL requires distribution of source code.
+
+Note that people who make modified versions of Engine3 are not obligated
+to grant this special exception for their modified versions;
+it is their choice whether to do so. The GNU Lesser General Public License
+gives permission to release a modified version without this exception;
+this exception also makes it possible to release a modified version
+which carries forward this exception.
+*/
+
+#ifndef GALLOPNOTIFYAVAILABLEEVENT_H_
+#define GALLOPNOTIFYAVAILABLEEVENT_H_
+
+#include "server/zone/objects/creature/CreatureObject.h"
+
+class GallopNotifyAvailableEvent : public Task {
+       ManagedWeakReference<CreatureObject*> creo;
+
+public:
+       GallopNotifyAvailableEvent(CreatureObject* cr) : Task() {
+               creo = cr;
+       }
+
+       void run() {
+               ManagedReference<CreatureObject*> creature = creo.get();
+
+               if (creature == NULL)
+                       return;
+
+               Locker locker(creature);
+
+               creature->removePendingTask("gallop_notify");
+               creature->sendSystemMessage("@combat_effects:mount_not_tired"); // Your mount is no longer winded.
+       }
+
+};
+
+#endif /*GALLOPNOTIFYAVAILABLEEVENT_H_*/