Go Back   EQEmulator Home > EQEmulator Forums > Development > Development: Custom Code

Development: Custom Code This is for code thatdoes not emulate live and wont be added to the official code.

Reply
 
Thread Tools Display Modes
  #1  
Old 09-27-2010, 10:57 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,450
Default PVP Permadeath Concept (W/ Support for Guild-Owned Doors & Guild-Owned NPCs in perl)

This is all of what I did for my permadeath PVP server. It goes against Revision 1668 of the EQEmu code.

It does the features posted in my server's thread, and adds support for guild-owned doors + guild-owned NPCs, a-la guildwars. It also has the ability to check which guild owns a door or NPC with perl or IsAttackAllowed accordingly.

The implementation could've been better for doors, but I figure DB calls are not going to be expensive as long as you don't call them too much.

If someone is interested in just the guild-owned doors and NPCs (or the attack code without that support) let me know.


Code:
Index: aggro.cpp
===================================================================
--- aggro.cpp    (revision 1668)
+++ aggro.cpp    (working copy)
@@ -41,7 +41,11 @@
         Mob* mob = iterator.GetData();
         if(mob->IsClient())    //also ensures that mob != around
             continue;
+
+        if(mob && mob->IsNPC() && mob->CastToNPC()->GetGuildID() == around->GuildID())
+            continue;
         
+        
         if(mob->CheckWillAggro(around)) {
             if(mob->IsEngaged())
             {
@@ -256,6 +260,18 @@
     if(ownr && ownr->IsClient() && !ownr->CastToClient()->ClientFinishedLoading())
         return false;
 
+    if(mob->IsNPC() && IsNPC())
+    {
+        if(CastToNPC()->GetGuildID() != 0 && mob->CastToNPC()->GetGuildID() != 0)
+        {
+            if(CastToNPC()->GetGuildID() == mob->CastToNPC()->GetGuildID())
+            {
+                return false;
+            }
+        }
+    }
+        return false;
+
     float iAggroRange = GetAggroRange();
     
     // Check If it's invisible and if we can see invis
@@ -499,7 +515,7 @@
 {
     Mob *mob1, *mob2, *tempmob;
     Client *c1, *c2, *becomenpc;
-//    NPC *npc1, *npc2;
+    NPC *npc1, *npc2;
     int reverse;
 
     if(!zone->CanDoCombat())
@@ -551,26 +567,31 @@
             {
                 c1 = mob1->CastToClient();
                 c2 = mob2->CastToClient();
-    
-                if    // if both are pvp they can fight
-                (
-                    c1->GetPVP() &&
-                    c2->GetPVP()
-                )
+
+                    if(zone->GetZoneID() == 1)
+                        return false;
+
+                    if(c1->GuildID() != 0xFFFFFFFF && c2->GuildID() != 0xFFFFFFFF)
+                    {
+                if(c1->GuildID() == c2->GuildID())
+                    return false;
+                    }
+                if(c1->GetGroup() && c2->GetGroup())
+                {
+                    if(c1->GetGroup()->GetID() == c2->GetGroup()->GetID())
+                        return false;
+                    else
+                        return true;
+                }
                     return true;
-                else if    // if they're dueling they can go at it
-                (
-                    c1->IsDueling() &&
-                    c2->IsDueling() &&
-                    c1->GetDuelTarget() == c2->GetID() &&
-                    c2->GetDuelTarget() == c1->GetID()
-                )
-                    return true;
-                else
-                    return false;
             }
             else if(_NPC(mob2))                // client vs npc
             {    
+            c1 = mob1->CastToClient();
+            npc1 = mob2->CastToNPC();
+
+                if(npc1->GetGuildID() == c1->GuildID())
+                    return false;
                 return true;
             }
             else if(_BECOMENPC(mob2))    // client vs becomenpc
@@ -596,7 +617,17 @@
         {
             if(_NPC(mob2))                        // npc vs npc
             {
-/*
+
+                npc1 = mob1->CastToNPC();
+                npc2 = mob2->CastToNPC();
+
+
+            if(npc1->GetGuildID() != 4294967295 && npc2->GetGuildID() != 4294967295)
+                {
+                if(npc1->GetGuildID() == npc2->GetGuildID())
+                    return false;
+                }
+                /*
 this says that an NPC can NEVER attack a faction ally...
 this is stupid... somebody else should check this rule if they want to
 enforce it, this just says 'can they possibly fight based on their
@@ -693,6 +724,7 @@
 {
     Mob *mob1, *mob2, *tempmob;
     Client *c1, *c2;
+    NPC *npc1, *npc2;
     int reverse;
 
     if(!target)
@@ -719,23 +751,41 @@
                 c1 = mob1->CastToClient();
                 c2 = mob2->CastToClient();
 
-                if(c1->GetPVP() == c2->GetPVP())
+
+                if(zone->GetZoneID() == 1)
+                        return true;
+
+
+                if(c1->GuildID() != 0xFFFFFFFF && c2->GuildID() != 0xFFFFFFFF)
+                {
+                if(c1->GuildID() == c2->GuildID())
                     return true;
-                else if    // if they're dueling they can heal each other too
-                (
-                    c1->IsDueling() &&
-                    c2->IsDueling() &&
-                    c1->GetDuelTarget() == c2->GetID() &&
-                    c2->GetDuelTarget() == c1->GetID()
-                )
-                    return true;
-                else
+                }
+
+                if(c1->GetGroup() && c2->GetGroup())
+                {
+                    if(c1->GetGroup()->GetID() != c2->GetGroup()->GetID())
+                        return false;
+                    else
+                        return true;
+                }
+
+
                     return false;
             }
             else if(_NPC(mob2))                // client to npc
             {
-                /* fall through and swap positions */
+            c1 = mob1->CastToClient();
+            npc2 = mob2->CastToNPC();
+
+            if(npc2->GetGuildID() != 0 && c1->GuildID() != 0)
+            {
+                if(npc2->GetGuildID() == c1->GuildID())
+                    return true;
             }
+                return false;
+
+            }
             else if(_BECOMENPC(mob2))    // client to becomenpc
             {
                 return false;
@@ -757,11 +807,24 @@
         {
             if(_CLIENT(mob2))
             {
+
+            npc1 = mob1->CastToNPC();
+            c2 = mob2->CastToClient();
+                if(npc1->GetGuildID() != 0 && c2->GuildID() != 0)
+                {
+                if(c2->GuildID() == npc1->GetGuildID())
+                    return true;
+                }
+
                 return false;
             }
             if(_NPC(mob2))                        // npc to npc
             {
-                return true;
+                npc1 = mob1->CastToNPC();
+                npc2 = mob2->CastToNPC();
+                if(npc1->GetGuildID() == npc2->GetGuildID())
+                    return true;
+                return false;
             }
             else if(_BECOMENPC(mob2))    // npc to becomenpc
             {
Index: attack.cpp
===================================================================
--- attack.cpp    (revision 1668)
+++ attack.cpp    (working copy)
@@ -1206,11 +1206,6 @@
         int min_hit = 1;
         int max_hit = (2*weapon_damage*GetDamageTable(skillinuse)) / 100;
 
-        if(GetLevel() < 10 && max_hit > 20)
-            max_hit = 20;
-        else if(GetLevel() < 20 && max_hit > 40)
-            max_hit = 40;
-
         CheckIncreaseSkill(skillinuse, other, -15);
         CheckIncreaseSkill(OFFENSE, other, -15);
 
@@ -1534,65 +1529,9 @@
     // #3: exp loss and corpse generation
     //
 
-    // figure out if they should lose exp
-    if(RuleB(Character, UseDeathExpLossMult)){
-        float GetNum [] = {0.005f,0.015f,0.025f,0.035f,0.045f,0.055f,0.065f,0.075f,0.085f,0.095f,0.110f };
-        int Num = RuleI(Character, DeathExpLossMultiplier);
-        if((Num < 0) || (Num > 10))
-            Num = 3;
-        float loss = GetNum[Num];
-        exploss=(int)((float)GetEXP() * (loss)); //loose % of total XP pending rule (choose 0-10)
-    }
 
-    if(!RuleB(Character, UseDeathExpLossMult)){
-        exploss = (int)(GetLevel() * (GetLevel() / 18.0) * 12000);
-    }
-
-    if( (GetLevel() < RuleI(Character, DeathExpLossLevel)) || (GetLevel() > RuleI(Character, DeathExpLossMaxLevel)) || IsBecomeNPC() )
-    {
-        exploss = 0;
-    }
-    else if( killerMob )
-    {
-        if( killerMob->IsClient() )
-        {
-            exploss = 0;
-        }
-        else if( killerMob->GetOwner() && killerMob->GetOwner()->IsClient() )
-        {
-            exploss = 0;
-        }
-    }
-
-    if(spell != SPELL_UNKNOWN)
-    {
-        uint32 buff_count = GetMaxTotalSlots();
-        for(uint16 buffIt = 0; buffIt < buff_count; buffIt++)
-        {
-            if(buffs[buffIt].spellid == spell && buffs[buffIt].client)
-            {
-                exploss = 0;    // no exp loss for pvp dot
-                break;
-            }
-        }
-    }
-    
-    // now we apply the exp loss, unmem their spells, and make a corpse
-    // unless they're a GM (or less than lvl 10
-    if(!GetGM())
-    {
-        if(exploss > 0) {
-            sint32 newexp = GetEXP();
-            if(exploss > newexp) {
-                //lost more than we have... wtf..
-                newexp = 1;
-            } else {
-                newexp -= exploss;
-            }
-            SetEXP(newexp, GetAAXP());
-            //m_epp.perAA = 0;    //reset to no AA exp on death.
-        }
-
+    SetLevel(1);
+    SetEXP(0,0);
         //this generates a lot of 'updates' to the client that the client does not need
         BuffFadeAll();
         UnmemSpellAll(false);
@@ -1600,7 +1539,7 @@
         if(RuleB(Character, LeaveCorpses) && GetLevel() >= RuleI(Character, DeathItemLossLevel) || RuleB(Character, LeaveNakedCorpses))
         {
             // creating the corpse takes the cash/items off the player too
-            Corpse *new_corpse = new Corpse(this, exploss);
+            Corpse *new_corpse = new Corpse(this, 0);
 
             char tmp[20];
             database.GetVariable("ServerType", tmp, 9);
@@ -1644,46 +1583,11 @@
 
 //        if(!IsLD())//Todo: make it so an LDed client leaves corpse if its enabled
 //            MakeCorpse(exploss);
-    } else {
-        BuffFadeDetrimental();
-    }
+    
 
 
 
-#if 0    // solar: commenting this out for now TODO reimplement becomenpc stuff
-    if (IsBecomeNPC() == true)
-    {
-        if (killerMob != NULL && killerMob->IsClient()) {
-            if (killerMob->CastToClient()->isgrouped && entity_list.GetGroupByMob(killerMob) != 0)
-                entity_list.GetGroupByMob(killerMob->CastToClient())->SplitExp((uint32)(level*level*75*3.5f), this);
 
-            else
-                killerMob->CastToClient()->AddEXP((uint32)(level*level*75*3.5f)); // Pyro: Comment this if NPC death crashes zone
-            //hate_list.DoFactionHits(GetNPCFactionID());
-        }
-
-        Corpse* corpse = new Corpse(this->CastToClient(), 0);
-        entity_list.AddCorpse(corpse, this->GetID());
-        this->SetID(0);
-        if(killerMob->GetOwner() != 0 && killerMob->GetOwner()->IsClient())
-            killerMob = killerMob->GetOwner();
-        if(killerMob != 0 && killerMob->IsClient()) {
-            corpse->AllowMobLoot(killerMob, 0);
-            if(killerMob->CastToClient()->isgrouped) {
-                Group* group = entity_list.GetGroupByClient(killerMob->CastToClient());
-                if(group != 0) {
-                    for(int i=0; i < MAX_GROUP_MEMBERS; i++) { // Doesnt work right, needs work
-                        if(group->members[i] != NULL) {
-                            corpse->AllowMobLoot(group->members[i],i);
-                        }
-                    }
-                }
-            }
-        }
-    }
-#endif
-
-
     //
     // Finally, send em home
     //
@@ -1692,9 +1596,9 @@
     // from these and overwrite what we set in pp anyway
     //
 
-    m_pp.zone_id = m_pp.binds[0].zoneId;
+    m_pp.zone_id = 1;
     m_pp.zoneInstance = 0;
-    database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(m_pp.zone_id));
+    database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(1));
         
     Save();
     
Index: bot.cpp
===================================================================
--- bot.cpp    (revision 1668)
+++ bot.cpp    (working copy)
@@ -759,7 +759,10 @@
 
 void Bot::GenerateArmorClass() {
     // Base AC
-    int bac = GetAC();
+    if(_baseAC)
+    int bac = _baseAC;
+    else
+    _baseAC = 0;
     switch(this->GetClass()) {
             case WARRIOR:
             case SHADOWKNIGHT:
@@ -8841,6 +8844,7 @@
     CHA += spellbonuses.CHA;
     ATK += spellbonuses.ATK;
 
+
     cur_hp = CalcMaxHP();
     GenerateBaseManaPoints();
     
Index: bot.h
===================================================================
--- bot.h    (revision 1668)
+++ bot.h    (working copy)
@@ -322,7 +322,7 @@
     sint16 _baseDR;
     sint16 _baseFR;
     sint16 _basePR;
-    int _baseAC;
+    int16 _baseAC;
     sint16 _baseSTR;
     sint16 _baseSTA;
     sint16 _baseDEX;
Index: client_packet.cpp
===================================================================
--- client_packet.cpp    (revision 1668)
+++ client_packet.cpp    (working copy)
@@ -3546,6 +3546,13 @@
             return;
         }
 
+        if(ent_corpse->IsLocked())
+        {
+            Message(13, "A player is already looting this corpse.");
+            Corpse::SendLootReqErrorPacket(this);
+            return;
+        }
+
         if(invisible) {
             BuffFadeByEffect(SE_Invisibility);
             BuffFadeByEffect(SE_Invisibility2);
@@ -8816,7 +8823,7 @@
     //enforce some rules..
     if(!CanBeInZone()) {
         _log(CLIENT__ERROR, "Kicking char from zone, not allowed here");
-        GoToSafeCoords(database.GetZoneID("arena"), 0);
+        GoToSafeCoords(database.GetZoneID("qeynos"), 0);
         return;
     }
 
@@ -9103,6 +9110,8 @@
 
 void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app)
 {
+
+    return;
     DumpPacket(app);
 
     RaidGeneral_Struct *ri = (RaidGeneral_Struct*)app->pBuffer;
Index: doors.cpp
===================================================================
--- doors.cpp    (revision 1668)
+++ doors.cpp    (working copy)
@@ -34,6 +34,7 @@
 
 extern EntityList entity_list;
 extern WorldServer worldserver;
+extern Zone* zone;
 
 Doors::Doors(const Door* door)
 :    close_timer(5000)
@@ -600,3 +601,8 @@
     }
     return true;
 }
+
+void Doors::SetGuildID(int32 guild_id) {
+    guild_id = guild_id; 
+    database.SetGuildDoor(GetDoorID(), guild_id, zone->GetShortName());
+}
\ No newline at end of file
Index: doors.h
===================================================================
--- doors.h    (revision 1668)
+++ doors.h    (working copy)
@@ -9,6 +9,7 @@
 #include "mob.h"
 #include "zonedump.h"
 
+
 class Doors : public Entity
 {
 public:
@@ -40,7 +41,7 @@
     int8    GetNoKeyring() { return nokeyring; }
     int16    GetLockpick() { return lockpick; } 
     int16    GetSize() { return size; }
-    void    SetGuildID(int32 guild_id) { guild_id = guild_id; }
+    void    SetGuildID(int32 guild_id);
 
     int32    GetEntityID() { return entity_id; }
     void    SetEntityID(int32 entity) { entity_id = entity; }
Index: entity.cpp
===================================================================
--- entity.cpp    (revision 1668)
+++ entity.cpp    (working copy)
@@ -4420,6 +4420,23 @@
     }
 }
 
+Doors* EntityList::GetDoorByDoorID(int8 id) { 
+    LinkedListIterator<Doors*> iterator(door_list); 
+    
+    iterator.Reset(); 
+    while(iterator.MoreElements()) 
+    { 
+        if (iterator.GetData()) 
+        { 
+            if (iterator.GetData()->GetDoorID() == id) {
+                return iterator.GetData();
+            }
+        } 
+        iterator.Advance(); 
+    } 
+    return 0; 
+} 
+
 void EntityList::GetNPCList(list<NPC*> &n_list)
 {
     n_list.clear();
Index: entity.h
===================================================================
--- entity.h    (revision 1668)
+++ entity.h    (working copy)
@@ -148,6 +148,7 @@
     Raid*    GetRaidByClient(Client* client);
     Raid*    GetRaidByID(int32 id);
     Raid*    GetRaidByLeaderName(const char *leader);
+    Doors* GetDoorByDoorID(int8 doorid); 
 
     Corpse*    GetCorpseByOwner(Client* client);
     Corpse* GetCorpseByID(int16 id);
Index: guild.cpp
===================================================================
--- guild.cpp    (revision 1668)
+++ guild.cpp    (working copy)
@@ -431,3 +431,22 @@
     return(affected_rows > 0);
 }
 
+bool ZoneDatabase::SetGuildNPC(int32 npc_type ,int16 guild_id) {
+    char errbuf[MYSQL_ERRMSG_SIZE];
+    char *query = 0;
+    int32    affected_rows = 0;
+
+    if (!RunQuery(query, MakeAnyLenString(&query, 
+        "UPDATE npc_types SET guildid = %i WHERE id = %i",
+        guild_id, npc_type), errbuf, 0,&affected_rows))
+    {
+        LogFile->write(EQEMuLog::Error, "Error in SetGuildNPC query '%s': %s", query, errbuf);
+        safe_delete_array(query);
+        return false;
+    }
+    
+    safe_delete_array(query);
+    
+    return(affected_rows > 0);
+}
+
Index: npc.cpp
===================================================================
--- npc.cpp    (revision 1668)
+++ npc.cpp    (working copy)
@@ -347,6 +347,7 @@
     guard_y_saved = 0;
     guard_z_saved = 0;
     guard_heading_saved = 0;
+    guildid = d->guildid;
     InitializeBuffSlots();
 }
       
Index: npc.h
===================================================================
--- npc.h    (revision 1668)
+++ npc.h    (working copy)
@@ -286,6 +286,9 @@
 
     bool IsLDoNLocked() const { return (ldon_locked); }
     void SetLDoNLocked(bool n) { ldon_locked = n; }
+    
+    int32 GetGuildID() const { return (guildid); }
+    void SetGuildID(int32 id) { guildid = id; }
 
     int16 GetLDoNLockedSkill() const { return (ldon_locked_skill); }
     void SetLDoNLockedSkill(int16 n) { ldon_locked_skill = n; }
@@ -392,7 +395,9 @@
     bool ldon_trap_detected;
     QGlobalCache *qGlobals;
     uint32 adventure_template_id;
+    int32 guildid;
 
+
 private:
     int32    loottable_id;
     bool    p_depop;
Index: perlparser.cpp
===================================================================
--- perlparser.cpp    (revision 1668)
+++ perlparser.cpp    (working copy)
@@ -3072,7 +3072,50 @@
     XSRETURN_EMPTY;
 }
 
+XS(XS__setdoorguildid);
+XS(XS__setdoorguildid)
+{
+    dXSARGS;
+    if (items != 2)
+        Perl_croak(aTHX_ "Usage: ");
+    int8 doorid = (int)SvIV(ST(0));
+    int32 guildid = (int)SvIV(ST(1));
 
+    quest_manager.SetDoorGuildID(doorid, guildid);
+
+    XSRETURN_EMPTY;
+}
+
+//    XSRETURN_IV(id);
+
+XS(XS__getdoorguildid);
+XS(XS__getdoorguildid)
+{
+    dXSARGS;
+    if (items != 1)
+        Perl_croak(aTHX_ "Usage: ");
+    int8 doorid = (int)SvIV(ST(0));
+
+    int32 guild = quest_manager.GetDoorGuildID(doorid);
+
+    XSRETURN_IV(guild);
+}
+
+XS(XS__setnpcguildid);
+XS(XS__setnpcguildid)
+{
+    dXSARGS;
+    if (items != 2)
+        Perl_croak(aTHX_ "Usage: fuck this, im the only person that should be seeing this");
+    int32 type = (int)SvIV(ST(0));
+    int32 guildid = (int)SvIV(ST(1));
+
+    quest_manager.SetNPCGuildID(type, guildid);
+
+    XSRETURN_EMPTY;
+}
+
+
 /*
 This is the callback perl will look for to setup the
 quest package's XSUBs
@@ -3271,7 +3314,10 @@
         newXS(strcpy(buf, "enabletitle"), XS__enabletitle, file);
         newXS(strcpy(buf, "removetitle"), XS__removetitle, file);
         newXS(strcpy(buf, "wearchange"), XS__wearchange, file);
-        newXS(strcpy(buf, "voicetell"), XS__voicetell, file);
+        newXS(strcpy(buf, "voicetell"), XS__voicetell, file);
+        newXS(strcpy(buf, "setdoorguildid"), XS__setdoorguildid, file);
+        newXS(strcpy(buf, "getdoorguildid"), XS__getdoorguildid, file);
+        newXS(strcpy(buf, "setnpcguildid"), XS__setdoorguildid, file);
     XSRETURN_YES;
 }
 
Index: PlayerCorpse.cpp
===================================================================
--- PlayerCorpse.cpp    (revision 1668)
+++ PlayerCorpse.cpp    (working copy)
@@ -822,24 +822,14 @@
         if (looter == 0)
             this->BeingLootedBy = 0xFFFFFFFF;
     }
-    int8 tCanLoot = 1;
+    int8 tCanLoot = 2;
     bool lootcoin=false;
     if(database.GetVariable("LootCoin",tmp, 9))
         lootcoin=(atoi(tmp)==1);
     if (this->BeingLootedBy != 0xFFFFFFFF && this->BeingLootedBy != client->GetID()) {
         SendLootReqErrorPacket(client, 0);
-        tCanLoot = 0;
+        tCanLoot = 1;
     }
-    else if(IsPlayerCorpse() && charid == client->CharacterID())
-        tCanLoot = 2;
-    else if ((IsNPCCorpse() || become_npc) && CanMobLoot(client->CharacterID()))
-        tCanLoot = 2;
-    else if(GetPKItem()==-1 && CanMobLoot(client->CharacterID()))
-        tCanLoot = 3; //pvp loot all items, variable cash
-    else if(GetPKItem()==1 && CanMobLoot(client->CharacterID()))
-        tCanLoot = 4; //pvp loot 1 item, variable cash
-    else if(GetPKItem()>1 && CanMobLoot(client->CharacterID()))
-        tCanLoot = 5; //pvp loot 1 set item, variable cash
     if(tCanLoot == 1){
         if (client->Admin() < 100 || !client->GetGM()) {
             SendLootReqErrorPacket(client, 2);
@@ -983,38 +973,19 @@
         SendEndLootErrorPacket(client);
         return;
     }
-    if (IsPlayerCorpse() && !CanMobLoot(client->CharacterID()) && !become_npc && (charid != client->CharacterID() && client->Admin() < 150)) {
-        client->Message(13, "Error: This is a player corpse and you dont own it.");
-        SendEndLootErrorPacket(client);
-        return;
-    }
     if (pLocked && client->Admin() < 100) {
         SendLootReqErrorPacket(client, 0);
         client->Message(13, "Error: Corpse locked by GM.");
         return;
     }
-    if(IsPlayerCorpse() && (charid != client->CharacterID()) && CanMobLoot(client->CharacterID()) && GetPKItem()==0){
-        client->Message(13, "Error: You cannot loot any more items from this corpse.");
-        SendEndLootErrorPacket(client);
-        BeingLootedBy = 0xFFFFFFFF;
-        return;
-    }
+
     const Item_Struct* item = 0;
     ItemInst *inst = 0;
     ServerLootItem_Struct* item_data = NULL, *bag_item_data[10];
     
     memset(bag_item_data, 0, sizeof(bag_item_data));
-    if(GetPKItem()>1)
-        item = database.GetItem(GetPKItem());
-    else if(GetPKItem()==-1 || GetPKItem()==1)
-        item_data = GetItem(lootitem->slot_id - 22); //dont allow them to loot entire bags of items as pvp reward
-    else
-        item_data = GetItem(lootitem->slot_id - 22, bag_item_data);
-
-    if (GetPKItem()<=1 && item_data != 0)
-    {
-        item = database.GetItem(item_data->item_id);
-    }
+    item_data = GetItem(lootitem->slot_id - 22, bag_item_data);
+    item = database.GetItem(item_data->item_id);
     
     if (item != 0)
     {
@@ -1136,10 +1107,7 @@
                 }
             }
         }
-        
-        if(GetPKItem()!=-1)
-            SetPKItem(0);
-        
+                
         //now send messages to all interested parties
 
         //creates a link for the item
Index: questmgr.cpp
===================================================================
--- questmgr.cpp    (revision 1668)
+++ questmgr.cpp    (working copy)
@@ -2464,3 +2464,26 @@
     }
 }
 
+void QuestManager::SetDoorGuildID(int8 doorid, int32 guildid) {
+
+    Doors* door = entity_list.GetDoorByDoorID(doorid);
+    if(door && door != NULL)
+        door->SetGuildID(guildid);
+        
+}
+
+int16 QuestManager::GetDoorGuildID(int8 doorid) {
+
+    Doors* door = entity_list.GetDoorByDoorID(doorid);
+    if(door && door != NULL)
+        return door->GetGuildID();
+    else
+        return 0;
+        
+}
+
+void QuestManager::SetNPCGuildID(int32 type, int32 guildid) {
+
+    database.SetGuildNPC(type, guildid);
+
+}
\ No newline at end of file
Index: questmgr.h
===================================================================
--- questmgr.h    (revision 1668)
+++ questmgr.h    (working copy)
@@ -217,7 +217,12 @@
     uint8 FactionValue();
     void wearchange(int8 slot, int16 texture);
     void voicetell(char *str, int macronum, int racenum, int gendernum);
+    void SetDoorGuildID(int8 doorid, int32 guildid);
+    void SetNPCGuildID(int32 type, int32 guildid);
+    int16 GetDoorGuildID(int8 doorid);
 
+
+
     //not in here because it retains perl types
     //thing ChooseRandom(array_of_things)
 
Index: spell_effects.cpp
===================================================================
--- spell_effects.cpp    (revision 1668)
+++ spell_effects.cpp    (working copy)
@@ -652,7 +652,7 @@
                 }
                 else
                 {
-                    Stun(effect_value);
+                    Stun(1000);
                 }
                 break;
             }
@@ -1342,7 +1342,7 @@
                 {
                     // solar: the spinning is handled by the client
                     if(buffslot >= 0)
-                        Stun(buffs[buffslot].ticsremaining * 6000);
+                        Stun(1000);
                 }
                 break;
             }
Index: Zone.vcproj
===================================================================
--- Zone.vcproj    (revision 1668)
+++ Zone.vcproj    (working copy)
@@ -1097,11 +1097,11 @@
                 >
             </File>
             <File
-                RelativePath="..\common\patches\SoF.cpp"
+                RelativePath="..\common\patches\SoD.cpp"
                 >
             </File>
             <File
-                RelativePath="..\common\patches\SoD.cpp"
+                RelativePath="..\common\patches\SoF.cpp"
                 >
             </File>
             <File
Index: zonedb.cpp
===================================================================
--- zonedb.cpp    (revision 1668)
+++ zonedb.cpp    (working copy)
@@ -1095,8 +1095,9 @@
             "npc_types.maxlevel,"
             "npc_types.scalerate,"
             "npc_types.private_corpse,"
-            "npc_types.unique_spawn_by_name";
-
+            "npc_types.unique_spawn_by_name,"
+            "npc_types.guildid";
+            
         MakeAnyLenString(&query, "%s FROM npc_types WHERE id=%d", basic_query, id);
 
         if (RunQuery(query, strlen(query), errbuf, &result)) {
@@ -1265,6 +1266,7 @@
                 tmpNPCType->scalerate = atoi(row[r++]);
                 tmpNPCType->private_corpse = atoi(row[r++]) == 1 ? true : false;
                 tmpNPCType->unique_spawn_by_name = atoi(row[r++]) == 1 ? true : false;
+                tmpNPCType->guildid = atoi(row[r++]);
 
                 // If NPC with duplicate NPC id already in table,
                 // free item we attempted to add.
Index: zonedb.h
===================================================================
--- zonedb.h    (revision 1668)
+++ zonedb.h    (working copy)
@@ -339,7 +339,14 @@
      */
     void QGlobalPurge();
 
+
     /*
+     * MortalQuest
+     */
+
+    bool SetGuildNPC(int32 npc_type ,int16 guild_id);
+
+    /*
      * Misc stuff.
      * PLEASE DO NOT ADD TO THIS COLLECTION OF CRAP UNLESS YOUR METHOD 
      * REALLY HAS NO BETTER SECTION
Index: zonedump.h
===================================================================
--- zonedump.h    (revision 1668)
+++ zonedump.h    (working copy)
@@ -117,6 +117,7 @@
     int32    scalerate;
     bool    private_corpse;
     bool    unique_spawn_by_name;
+    int32    guildid;
 };
 
 struct ZSDump_Spawn2 {
Index: zoning.cpp
===================================================================
--- zoning.cpp    (revision 1668)
+++ zoning.cpp    (working copy)
@@ -710,7 +710,7 @@
 }
 
 void Client::GoToDeath() {
-    MovePC(m_pp.binds[0].zoneId, 0.0f, 0.0f, 0.0f, 0.0f, 1, ZoneToBindPoint);
+    MovePC(1, 0.0f, 0.0f, 0.0f, 0.0f, 1, ZoneToBindPoint);
 }
 
 void Client::SetZoneFlag(uint32 zone_id) {
Reply With Quote
  #2  
Old 09-29-2010, 02:29 PM
So_1337
Dragon
 
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
Default

These are great to see, thanks Secrets =)
__________________
Yo mama so fat, if she moved past a black hole at high velocity it'd create a closed timelike curve.
Reply With Quote
  #3  
Old 10-01-2010, 03:42 AM
dlobrecht
Fire Beetle
 
Join Date: Sep 2010
Posts: 1
Question

Thank you for uploading your work, It is very much appreciated.

I am having trouble trying to patch this code to r1668.

I was able to patch your other custom code that you created : Disable PVP for same group/same guild without any problems.

I noticed a difference of spacing or tabs between the two patches.

Any ideas what I am doing wrong?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 02:45 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3