This commit is contained in:
Arthur Ice
2014-12-05 20:16:13 -08:00
124 changed files with 63220 additions and 2537 deletions
+38 -37
View File
@@ -15,15 +15,34 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/bodytypes.h"
#include "../common/classes.h"
#include "../common/debug.h"
#include <iostream>
#include <string>
#include <cctype>
#include <math.h>
#include "../common/moremath.h"
#include <stdio.h>
#include "../common/packet_dump_file.h"
#include "../common/misc_functions.h"
#include "../common/rulesys.h"
#include "../common/seperator.h"
#include "../common/spdat.h"
#include "../common/string_util.h"
#include "../common/clientversions.h"
#include "../common/features.h"
#include "../common/item.h"
#include "../common/item_struct.h"
#include "../common/linked_list.h"
#include "../common/servertalk.h"
#include "aa.h"
#include "client.h"
#include "entity.h"
#include "npc.h"
#include "string_ids.h"
#include "spawn2.h"
#include "zone.h"
#include <cctype>
#include <stdio.h>
#include <string>
#ifdef _WINDOWS
#define snprintf _snprintf
#define strncasecmp _strnicmp
@@ -33,27 +52,10 @@
#include <pthread.h>
#endif
#include "npc.h"
#include "map.h"
#include "entity.h"
#include "masterentity.h"
#include "../common/spdat.h"
#include "../common/bodytypes.h"
#include "spawngroup.h"
#include "../common/misc_functions.h"
#include "../common/string_util.h"
#include "../common/rulesys.h"
#include "string_ids.h"
//#define SPELLQUEUE //Use only if you want to be spammed by spell testing
extern Zone* zone;
extern volatile bool ZoneLoaded;
extern EntityList entity_list;
#include "quest_parser_collection.h"
NPC::NPC(const NPCType* d, Spawn2* in_respawn, const xyz_heading& position, int iflymode, bool IsCorpse)
: Mob(d->name,
d->lastname,
@@ -283,7 +285,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, const xyz_heading& position, int
if(trap_list.size() > 0)
{
std::list<LDoNTrapTemplate*>::iterator trap_list_iter = trap_list.begin();
std::advance(trap_list_iter, MakeRandomInt(0, trap_list.size() - 1));
std::advance(trap_list_iter, zone->random.Int(0, trap_list.size() - 1));
LDoNTrapTemplate* tt = (*trap_list_iter);
if(tt)
{
@@ -536,10 +538,10 @@ void NPC::AddCash(uint16 in_copper, uint16 in_silver, uint16 in_gold, uint16 in_
}
void NPC::AddCash() {
copper = MakeRandomInt(1, 100);
silver = MakeRandomInt(1, 50);
gold = MakeRandomInt(1, 10);
platinum = MakeRandomInt(1, 5);
copper = zone->random.Int(1, 100);
silver = zone->random.Int(1, 50);
gold = zone->random.Int(1, 10);
platinum = zone->random.Int(1, 5);
}
void NPC::RemoveCash() {
@@ -656,8 +658,7 @@ bool NPC::Process()
viral_timer_counter = 0;
}
if(projectile_timer.Check())
SpellProjectileEffect();
ProjectileAttack();
if(spellbonuses.GravityEffect == 1) {
if(gravity_timer.Check())
@@ -1359,7 +1360,7 @@ void NPC::PickPocket(Client* thief) {
return;
}
if(MakeRandomInt(0, 100) > 95){
if(zone->random.Roll(5)) {
AddToHateList(thief, 50);
Say("Stop thief!");
thief->Message(13, "You are noticed trying to steal!");
@@ -1388,7 +1389,7 @@ void NPC::PickPocket(Client* thief) {
memset(charges,0,50);
//Determine wheter to steal money or an item.
bool no_coin = ((money[0] + money[1] + money[2] + money[3]) == 0);
bool steal_item = (MakeRandomInt(0, 99) < 50 || no_coin);
bool steal_item = (zone->random.Roll(50) || no_coin);
if (steal_item)
{
ItemList::iterator cur,end;
@@ -1418,7 +1419,7 @@ void NPC::PickPocket(Client* thief) {
}
if (x > 0)
{
int random = MakeRandomInt(0, x-1);
int random = zone->random.Int(0, x-1);
inst = database.CreateItem(steal_items[random], charges[random]);
if (inst)
{
@@ -1453,7 +1454,7 @@ void NPC::PickPocket(Client* thief) {
}
if (!steal_item) //Steal money
{
uint32 amt = MakeRandomInt(1, (steal_skill/25)+1);
uint32 amt = zone->random.Int(1, (steal_skill/25)+1);
int steal_type = 0;
if (!money[0])
{
@@ -1468,7 +1469,7 @@ void NPC::PickPocket(Client* thief) {
}
}
if (MakeRandomInt(0, 100) <= stealchance)
if (zone->random.Roll(stealchance))
{
switch (steal_type)
{
@@ -1949,7 +1950,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue)
void NPC::LevelScale() {
uint8 random_level = (MakeRandomInt(level, maxlevel));
uint8 random_level = (zone->random.Int(level, maxlevel));
float scaling = (((random_level / (float)level) - 1) * (scalerate / 100.0f));