Changeset 18

Show
Ignore:
Timestamp:
11/19/08 13:23:29 (17 years ago)
Author:
yumileroy
Message:

[svn] * Little fix in RandomMovementGenerator?
* Updated to 6731 and 680

Original author: Neo2003
Date: 2008-10-06 04:48:59-05:00

Location:
trunk
Files:
1 added
47 modified
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sql/mangos.sql

    r9 r18  
    23392339(329,'  %s (GUID %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), 
    23402340(330,'No players found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), 
     2341(331,'Extended item cost %u not exist',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), 
    23412342(400,'|cffff0000[System Message]:|rScripts reloaded',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), 
    23422343(401,'You change security level of %s to %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), 
     
    1048610487CREATE TABLE `quest_template` ( 
    1048710488  `entry` mediumint(8) unsigned NOT NULL default '0', 
     10489  `Method` tinyint(3) unsigned NOT NULL default '2', 
    1048810490  `ZoneOrSort` smallint(6) NOT NULL default '0', 
    1048910491  `SkillOrClass` smallint(6) NOT NULL default '0', 
  • trunk/src/bindings/scripts/docs/EventAI.txt

    r2 r18  
    6806803       8           CAST_NO_MELEE_IF_OOM           Prevents creature from entering melee if out of mana or out of range 
    6816814       16          CAST_FORCE_TARGET_SELF         Forces the target to cast this spell on itself 
     6825       32          CAST_AURA_NOT_PRESENT          Only casts the spell on the target if the target does not have the aura from that spell on itself already. 
    682683 
    683684NOTE: You can add the numbers in the decimal column to combine flags.  
  • trunk/src/bindings/scripts/include/sc_creature.cpp

    r13 r18  
    3636            if (!InCombat) 
    3737            { 
     38                InCombat = true; 
    3839                Aggro(who); 
    39                 InCombat = true; 
    4040            } 
    4141        } 
     
    5555        if (!InCombat) 
    5656        { 
     57            InCombat = true; 
    5758            Aggro(who); 
    58             InCombat = true; 
    5959        } 
    6060    } 
     
    583583            if (!InCombat) 
    584584            { 
     585                InCombat = true; 
    585586                Aggro(who); 
    586                 InCombat = true; 
    587587            } 
    588588        } 
     
    602602        if (!InCombat) 
    603603        { 
     604            InCombat = true; 
    604605            Aggro(who); 
    605             InCombat = true; 
    606606        } 
    607607    } 
  • trunk/src/bindings/scripts/scripts/creature/mob_event_ai.cpp

    r14 r18  
    5656                    ProcessEvent(*i); 
    5757                    break; 
    58                 default: 
    59                     break; 
    6058            } 
    6159        } 
     
    613611                } 
    614612 
    615                 //Interrupt any previous spell 
    616                 if (caster->IsNonMeleeSpellCasted(false) && param3 & CAST_INTURRUPT_PREVIOUS) 
    617                     caster->InterruptNonMeleeSpells(false); 
    618  
    619                 //Cast only if not casting or if spell is triggered 
    620                 if (param3 & CAST_TRIGGERED || !caster->IsNonMeleeSpellCasted(false)) 
     613                //Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered 
     614                bool canCast = !(caster->IsNonMeleeSpellCasted(false) && (param3 & CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS)); 
     615 
     616                // If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them 
     617                if(param3 & CAST_AURA_NOT_PRESENT) 
     618                { 
     619                    for(uint8 i = 0; i < 3; ++i) 
     620                        if(target->HasAura(param1, i)) 
     621                            return; 
     622                } 
     623 
     624                if (canCast) 
    621625                { 
    622626                    const SpellEntry* tSpell = GetSpellStore()->LookupEntry(param1); 
     
    639643                            } 
    640644 
    641                         }else caster->CastSpell(target, param1, (param3 & CAST_TRIGGERED)); 
     645                        }else 
     646                        { 
     647                            //Interrupt any previous spell 
     648                            if (caster->IsNonMeleeSpellCasted(false) && param3 & CAST_INTURRUPT_PREVIOUS) 
     649                                caster->InterruptNonMeleeSpells(false); 
     650 
     651                            caster->CastSpell(target, param1, (param3 & CAST_TRIGGERED)); 
     652                        } 
    642653 
    643654                    }else if (EAI_ErrorLevel > 0) 
     
    9971008                    } 
    9981009                    break; 
    999                 default: 
     1010                //default: 
    10001011                    //TODO: enable below code line / verify this is correct to enable events previously disabled (ex. aggro yell), instead of enable this in void Aggro() 
    10011012                    //(*i).Enabled = true; 
    10021013                    //(*i).Time = 0; 
    1003                     break; 
     1014                    //break; 
    10041015            } 
    10051016        } 
     
    10301041                    ProcessEvent(*i); 
    10311042                    break; 
    1032                 default: 
    1033                     break; 
    10341043            } 
    10351044        } 
     
    10511060                    ProcessEvent(*i, killer); 
    10521061                    break; 
    1053                 default: 
    1054                     break; 
    10551062            } 
    10561063        } 
     
    10701077                    ProcessEvent(*i, victim); 
    10711078                    break; 
    1072                 default: 
    1073                     break; 
    10741079            } 
    10751080        } 
     
    10891094                case EVENT_T_SUMMONED_UNIT: 
    10901095                    ProcessEvent(*i, pUnit); 
    1091                     break; 
    1092                 default: 
    10931096                    break; 
    10941097            } 
     
    11461149            if (!InCombat) 
    11471150            { 
     1151                InCombat = true; 
    11481152                Aggro(who); 
    1149                 InCombat = true; 
    11501153            } 
    11511154        } 
     
    11941197                if (!InCombat) 
    11951198                { 
     1199                    InCombat = true; 
    11961200                    Aggro(who); 
    1197                     InCombat = true; 
    11981201                } 
    11991202            } 
     
    12151218                                ProcessEvent(*i, pUnit); 
    12161219                    } 
    1217                     break; 
    1218                 default: 
    12191220                    break; 
    12201221            } 
  • trunk/src/bindings/scripts/scripts/creature/mob_event_ai.h

    r6 r18  
    114114    CAST_NO_MELEE_IF_OOM        = 0x08,     //Prevents creature from entering melee if out of mana or out of range 
    115115    CAST_FORCE_TARGET_SELF      = 0x10,     //Forces the target to cast this spell on itself 
     116    CAST_AURA_NOT_PRESENT       = 0x20,     //Only casts the spell if the target does not have an aura from the spell 
    116117}; 
    117118 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp

    r6 r18  
    105105                    Class_Timer = 10000; 
    106106                    break; 
    107                 default: 
    108                     break; 
    109107            } 
    110108        }else Class_Timer -= diff; 
     
    205203                if (!InCombat) 
    206204                { 
     205                    InCombat = true; 
    207206                    Aggro(who); 
    208                     InCombat = true; 
    209207                } 
    210208            } 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp

    r6 r18  
    107107                if (!InCombat) 
    108108                { 
     109                    InCombat = true; 
    109110                    Aggro(who); 
    110                     InCombat = true; 
    111111                } 
    112112            } 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/boss_tailonking_ikiss.cpp

    r6 r18  
    116116                if (!InCombat) 
    117117                { 
     118                    InCombat = true; 
    118119                    Aggro(who); 
    119                     InCombat = true; 
    120120                } 
    121121            } 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp

    r6 r18  
    126126                if (!InCombat) 
    127127                { 
     128                    InCombat = true; 
    128129                    Aggro(who); 
    129                     InCombat = true; 
    130130                } 
    131131            } 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp

    r6 r18  
    7575            if (!InCombat) 
    7676            { 
     77                InCombat = true; 
    7778                Aggro(who); 
    78                 InCombat = true; 
    7979            } 
    8080        } 
     
    9696                if (!InCombat) 
    9797                { 
     98                    InCombat = true; 
    9899                    Aggro(who); 
    99                     InCombat = true; 
    100100                } 
    101101            } 
  • trunk/src/bindings/scripts/scripts/zone/burning_steppes/burning_steppes.cpp

    r6 r18  
    6262                if (!InCombat) 
    6363                { 
     64                    InCombat = true; 
    6465                    Aggro(who); 
    65                     InCombat = true; 
    6666                } 
    6767            } 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp

    r6 r18  
    118118            if (!InCombat) 
    119119            { 
     120                InCombat = true; 
    120121                Aggro(who); 
    121                 InCombat = true; 
    122122            } 
    123123        } 
     
    139139                if (!InCombat) 
    140140                { 
     141                    InCombat = true; 
    141142                    Aggro(who); 
    142                     InCombat = true; 
    143143                } 
    144144            } 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_watchkeeper_gargolmar.cpp

    r6 r18  
    109109                if (!InCombat) 
    110110                { 
     111                    InCombat = true; 
    111112                    Aggro(who); 
    112                     InCombat = true; 
    113113                } 
    114114            } 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp

    r6 r18  
    201201            if( !InCombat ) 
    202202            { 
     203                InCombat = true; 
    203204                Aggro(who); 
    204                 InCombat = true; 
    205205            } 
    206206        } 
     
    238238                if( !InCombat ) 
    239239                { 
     240                    InCombat = true; 
    240241                    Aggro(who); 
    241                     InCombat = true; 
    242242                } 
    243243            } 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/boss_prince_malchezaar.cpp

    r6 r18  
    583583        { 
    584584            //Check for base attack 
    585             if( m_creature->isAttackReady()) 
     585            if( m_creature->isAttackReady() && m_creature->getVictim() ) 
    586586            { 
    587587                m_creature->AttackerStateUpdate(m_creature->getVictim()); 
     
    589589            } 
    590590            //Check for offhand attack 
    591             if( m_creature->isAttackReady(OFF_ATTACK)) 
     591            if( m_creature->isAttackReady(OFF_ATTACK) && m_creature->getVictim() ) 
    592592            { 
    593593                m_creature->AttackerStateUpdate(m_creature->getVictim(), OFF_ATTACK); 
  • trunk/src/bindings/scripts/scripts/zone/molten_core/instance_molten_core.cpp

    r6 r18  
    164164                    FlamewakerPriest = creature->GetGUID(); 
    165165                    break; 
    166  
    167                 default: 
    168                     return; 
    169166            } 
    170167        } 
  • trunk/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp

    r6 r18  
    265265                    ++Phase; 
    266266                    break; 
    267                 default: 
    268                     break; 
    269267            } 
    270268        } else Event_Timer -= diff; 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/arcatraz.cpp

    r6 r18  
    139139                if (!InCombat) 
    140140                { 
     141                    InCombat = true; 
    141142                    Aggro(who); 
    142                     InCombat = true; 
    143143                } 
    144144            } 
     
    154154            if (!InCombat) 
    155155            { 
     156                InCombat = true; 
    156157                Aggro(who); 
    157                 InCombat = true; 
    158158            } 
    159159        } 
     
    445445                    pInstance->SetData(TYPE_WARDEN_5,IN_PROGRESS); 
    446446                    break; 
    447                 default: 
    448                     break; 
    449447            } 
    450448            CanSpawn = true; 
     
    506504                        DoPlaySoundToSet(m_creature,SOUND_WELCOME); 
    507505                        break; 
    508                     default: 
    509                         break; 
    510506                } 
    511507                CanSpawn = false; 
     
    554550                        EventProgress_Timer = 15000; 
    555551                        break; 
    556                     default: 
    557                         break; 
    558552                } 
    559553            } 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp

    r6 r18  
    131131                if (!InCombat) 
    132132                { 
     133                    InCombat = true; 
    133134                    Aggro(who); 
    134                     InCombat = true; 
    135135                } 
    136136            } 
     
    149149            if( !InCombat ) 
    150150            { 
     151                InCombat = true; 
    151152                Aggro(who); 
    152                 InCombat = true; 
    153153            } 
    154154        } 
     
    237237                        Intro = true; 
    238238                        break; 
    239                     default: 
    240                         break; 
    241239                } 
    242240            }else Intro_Timer -=diff; 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp

    r6 r18  
    216216                if (!InCombat) 
    217217                { 
     218                    InCombat = true; 
    218219                    Aggro(who); 
    219                     InCombat = true; 
    220220                } 
    221221            } 
     
    235235            if (!InCombat) 
    236236            { 
     237                InCombat = true; 
    237238                Aggro(who); 
    238                 InCombat = true; 
    239239            } 
    240240        } 
     
    864864                            DoPlaySoundToSet(m_creature, SOUND_SUMMON_PHOENIX1); 
    865865                            break; 
    866  
    867866                        case 1: 
    868867                            DoYell(SAY_SUMMON_PHOENIX2, LANG_UNIVERSAL, NULL); 
    869868                            DoPlaySoundToSet(m_creature, SOUND_SUMMON_PHOENIX2); 
    870                             break; 
    871  
    872                         default: 
    873869                            break; 
    874870                    } 
     
    12531249            if (!InCombat) 
    12541250            { 
     1251                InCombat = true; 
    12551252                Aggro(who); 
    1256                 InCombat = true; 
    12571253            } 
    12581254        } 
  • trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp

    r6 r18  
    666666            if (!InCombat) 
    667667            { 
     668                InCombat = true; 
    668669                Aggro(who); 
    669                 InCombat = true; 
    670670            } 
    671671        } 
  • trunk/src/game/Chat.cpp

    r9 r18  
    3434 
    3535bool ChatHandler::load_command_table = true; 
    36  
    37 LanguageDesc lang_description[LANGUAGES_COUNT] = 
    38 { 
    39     { LANG_ADDON,           0, 0                       }, 
    40     { LANG_UNIVERSAL,       0, 0                       }, 
    41     { LANG_ORCISH,        669, SKILL_LANG_ORCISH       }, 
    42     { LANG_DARNASSIAN,    671, SKILL_LANG_DARNASSIAN   }, 
    43     { LANG_TAURAHE,       670, SKILL_LANG_TAURAHE      }, 
    44     { LANG_DWARVISH,      672, SKILL_LANG_DWARVEN      }, 
    45     { LANG_COMMON,        668, SKILL_LANG_COMMON       }, 
    46     { LANG_DEMONIC,       815, SKILL_LANG_DEMON_TONGUE }, 
    47     { LANG_TITAN,         816, SKILL_LANG_TITAN        }, 
    48     { LANG_THALASSIAN,    813, SKILL_LANG_THALASSIAN   }, 
    49     { LANG_DRACONIC,      814, SKILL_LANG_DRACONIC     }, 
    50     { LANG_KALIMAG,       817, SKILL_LANG_OLD_TONGUE   }, 
    51     { LANG_GNOMISH,      7340, SKILL_LANG_GNOMISH      }, 
    52     { LANG_TROLL,        7341, SKILL_LANG_TROLL        }, 
    53     { LANG_GUTTERSPEAK, 17737, SKILL_LANG_GUTTERSPEAK  }, 
    54     { LANG_DRAENEI,     29932, SKILL_LANG_DRAENEI      }, 
    55     { LANG_ZOMBIE,          0, 0                       }, 
    56     { LANG_GNOMISH_BINARY,  0, 0                       }, 
    57     { LANG_GOBLIN_BINARY,   0, 0                       } 
    58 }; 
    59  
    60 LanguageDesc const* GetLanguageDescByID(uint32 lang) 
    61 { 
    62     for(int i = 0; i < LANGUAGES_COUNT; ++i) 
    63     { 
    64         if(uint32(lang_description[i].lang_id) == lang) 
    65             return &lang_description[i]; 
    66     } 
    67  
    68     return NULL; 
    69 } 
    70  
    71 LanguageDesc const* GetLanguageDescBySpell(uint32 spell_id) 
    72 { 
    73     for(int i = 0; i < LANGUAGES_COUNT; ++i) 
    74     { 
    75         if(lang_description[i].spell_id == spell_id) 
    76             return &lang_description[i]; 
    77     } 
    78  
    79     return NULL; 
    80 } 
    81  
    82 LanguageDesc const* GetLanguageDescBySkill(uint32 skill_id) 
    83 { 
    84     for(int i = 0; i < LANGUAGES_COUNT; ++i) 
    85     { 
    86         if(lang_description[i].skill_id == skill_id) 
    87             return &lang_description[i]; 
    88     } 
    89  
    90     return NULL; 
    91 } 
    9236 
    9337ChatCommand * ChatHandler::getCommandTable() 
  • trunk/src/game/Chat.h

    r9 r18  
    2828class Unit; 
    2929struct GameTele; 
    30  
    31 struct LanguageDesc 
    32 { 
    33     Language lang_id; 
    34     uint32   spell_id; 
    35     uint32   skill_id; 
    36 }; 
    37  
    38 extern LanguageDesc lang_description[LANGUAGES_COUNT]; 
    39  
    40 LanguageDesc const* GetLanguageDescByID(uint32 lang); 
    41 LanguageDesc const* GetLanguageDescBySpell(uint32 spell_id); 
    42 LanguageDesc const* GetLanguageDescBySkill(uint32 skill_id); 
    4330 
    4431class ChatCommand 
  • trunk/src/game/Creature.cpp

    r14 r18  
    6363} 
    6464 
     65bool VendorItemData::RemoveItem( uint32 item_id ) 
     66{ 
     67    for(VendorItemList::iterator i = m_items.begin(); i != m_items.end(); ++i ) 
     68    { 
     69        if((*i)->item==item_id) 
     70        { 
     71            m_items.erase(i); 
     72            return true; 
     73        } 
     74    } 
     75    return false; 
     76} 
     77 
     78VendorItem const* VendorItemData::FindItem(uint32 item_id) const 
     79{ 
     80    for(VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i ) 
     81        if((*i)->item==item_id) 
     82            return *i; 
     83    return NULL; 
     84} 
     85 
    6586Creature::Creature() : 
    6687Unit(), i_AI(NULL), 
    6788lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0), 
    68 m_itemsLoaded(false), m_lootMoney(0), m_lootRecipient(0), 
     89m_lootMoney(0), m_lootRecipient(0), 
    6990m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f), 
    7091m_gossipOptionLoaded(false),m_emoteState(0), m_isPet(false), m_isTotem(false), 
    7192m_regenTimer(2000), m_defaultMovementType(IDLE_MOTION_TYPE), m_equipmentId(0), 
    7293m_AlreadyCallAssistence(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), 
    73 m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),m_creatureInfo(NULL) 
     94m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),m_creatureInfo(NULL), m_DBTableGuid(0) 
    7495{ 
    7596    m_valuesCount = UNIT_END; 
     
    88109    CleanupsBeforeDelete(); 
    89110 
    90     m_vendor_items.clear(); 
     111    m_vendorItemCounts.clear(); 
    91112 
    92113    delete i_AI; 
     
    504525                break; 
    505526        } 
     527        LoadCreaturesAddon(); 
    506528    } 
    507529 
     
    674696                        break; 
    675697                    case GOSSIP_OPTION_VENDOR: 
    676                         // load vendor items if not yet 
    677                         LoadGoods(); 
    678  
    679                         if(!GetItemCount()) 
     698                    { 
     699                        VendorItemData const* vItems = GetVendorItems(); 
     700                        if(!vItems || vItems->Empty()) 
    680701                        { 
    681702                            sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", 
     
    684705                        } 
    685706                        break; 
     707                    } 
    686708                    case GOSSIP_OPTION_TRAINER: 
    687709                        if(!isCanTrainingOf(pPlayer,false)) 
     
    935957uint32 Creature::GetNpcTextId() 
    936958{ 
     959    if (!m_DBTableGuid) 
     960        return DEFAULT_GOSSIP_MESSAGE; 
     961 
    937962    if(uint32 pos = objmgr.GetNpcGossip(m_DBTableGuid)) 
    938963        return pos; 
     
    10471072{ 
    10481073    // update in loaded data 
     1074    if (!m_DBTableGuid) 
     1075        m_DBTableGuid = GetGUIDLow(); 
    10491076    CreatureData& data = objmgr.NewOrExistCreatureData(m_DBTableGuid); 
    10501077 
     
    12381265    Object::_Create(guidlow, Entry, HIGHGUID_UNIT); 
    12391266 
    1240     m_DBTableGuid = guidlow; 
    12411267    if(!UpdateEntry(Entry, team, data)) 
    12421268        return false; 
     
    12641290    } 
    12651291 
    1266     uint32 stored_guid = guid; 
     1292    m_DBTableGuid = guid; 
    12671293    if (map->GetInstanceId() != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT); 
    12681294 
     
    12781304        return false; 
    12791305    } 
    1280  
    1281     m_DBTableGuid = stored_guid; 
    1282     LoadCreaturesAddon(); 
    12831306 
    12841307    m_respawnradius = data->spawndist; 
     
    13471370} 
    13481371 
    1349 void Creature::LoadGoods() 
    1350 { 
    1351     // already loaded; 
    1352     if(m_itemsLoaded) 
    1353         return; 
    1354  
    1355     m_vendor_items.clear(); 
    1356  
    1357     VendorItemList const* vList = objmgr.GetNpcVendorItemList(GetEntry()); 
    1358     if(!vList) 
    1359         return; 
    1360  
    1361     for (VendorItemList::const_iterator _item_iter = vList->begin(); _item_iter != vList->end(); ++_item_iter) 
    1362         AddItem( (*_item_iter)->item, (*_item_iter)->maxcount, (*_item_iter)->incrtime, (*_item_iter)->ExtendedCost); 
    1363  
    1364     m_itemsLoaded = true; 
    1365 } 
    1366  
    13671372bool Creature::hasQuest(uint32 quest_id) const 
    13681373{ 
     
    13891394void Creature::DeleteFromDB() 
    13901395{ 
     1396    if (!m_DBTableGuid) 
     1397    { 
     1398        sLog.outDebug("Trying to delete not saved creature!"); 
     1399        return; 
     1400    } 
     1401 
    13911402    objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),0); 
    13921403    objmgr.DeleteCreatureData(m_DBTableGuid); 
     
    14951506    if(getDeathState()==DEAD) 
    14961507    { 
    1497         objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),0); 
     1508        if (m_DBTableGuid) 
     1509            objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),0); 
    14981510        m_respawnTime = time(NULL);                         // respawn at next tick 
    14991511    } 
     
    17171729void Creature::SaveRespawnTime() 
    17181730{ 
    1719     if(isPet()) 
     1731    if(isPet() || !m_DBTableGuid) 
    17201732        return; 
    17211733 
     
    17531765CreatureDataAddon const* Creature::GetCreatureAddon() const 
    17541766{ 
    1755     if(CreatureDataAddon const* addon = ObjectMgr::GetCreatureAddon(m_DBTableGuid)) 
    1756         return addon; 
     1767    if (m_DBTableGuid) 
     1768    { 
     1769        if(CreatureDataAddon const* addon = ObjectMgr::GetCreatureAddon(m_DBTableGuid)) 
     1770            return addon; 
     1771    } 
    17571772 
    17581773    // dependent from heroic mode entry 
     
    19571972} 
    19581973 
     1974 
     1975VendorItemData const* Creature::GetVendorItems() const 
     1976{ 
     1977    return objmgr.GetNpcVendorItemList(GetEntry()); 
     1978} 
     1979 
     1980uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem) 
     1981{ 
     1982    if(!vItem->maxcount) 
     1983        return vItem->maxcount; 
     1984 
     1985    VendorItemCounts::iterator itr = m_vendorItemCounts.begin(); 
     1986    for(; itr != m_vendorItemCounts.end(); ++itr) 
     1987        if(itr->itemId==vItem->item) 
     1988            break; 
     1989 
     1990    if(itr == m_vendorItemCounts.end()) 
     1991        return vItem->maxcount; 
     1992 
     1993    VendorItemCount* vCount = &*itr; 
     1994 
     1995    time_t ptime = time(NULL); 
     1996 
     1997    if( vCount->lastIncrementTime + vItem->incrtime <= ptime ) 
     1998    { 
     1999        ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item); 
     2000 
     2001        uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime); 
     2002        if((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount ) 
     2003        { 
     2004            m_vendorItemCounts.erase(itr);         
     2005            return vItem->maxcount; 
     2006        } 
     2007 
     2008        vCount->count += diff * pProto->BuyCount; 
     2009        vCount->lastIncrementTime = ptime; 
     2010    } 
     2011 
     2012    return vCount->count; 
     2013} 
     2014 
     2015uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 used_count) 
     2016{ 
     2017    if(!vItem->maxcount) 
     2018        return 0; 
     2019 
     2020    VendorItemCounts::iterator itr = m_vendorItemCounts.begin(); 
     2021    for(; itr != m_vendorItemCounts.end(); ++itr) 
     2022        if(itr->itemId==vItem->item) 
     2023            break; 
     2024 
     2025    if(itr == m_vendorItemCounts.end()) 
     2026    { 
     2027        uint32 new_count = vItem->maxcount > used_count ? vItem->maxcount-used_count : 0; 
     2028        m_vendorItemCounts.push_back(VendorItemCount(vItem->item,new_count)); 
     2029        return new_count; 
     2030    } 
     2031 
     2032    VendorItemCount* vCount = &*itr; 
     2033 
     2034    time_t ptime = time(NULL); 
     2035 
     2036    if( vCount->lastIncrementTime + vItem->incrtime <= ptime ) 
     2037    { 
     2038        ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item); 
     2039 
     2040        uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime); 
     2041        if((vCount->count + diff * pProto->BuyCount) < vItem->maxcount ) 
     2042            vCount->count += diff * pProto->BuyCount; 
     2043        else 
     2044            vCount->count = vItem->maxcount; 
     2045    } 
     2046 
     2047    vCount->count = vCount->count > used_count ? vCount->count-used_count : 0; 
     2048    vCount->lastIncrementTime = ptime; 
     2049    return vCount->count; 
     2050} 
     2051 
    19592052TrainerSpellData const* Creature::GetTrainerSpells() const 
    19602053{ 
  • trunk/src/game/Creature.h

    r14 r18  
    111111    uint32 Action; 
    112112    std::string Option; 
    113 }; 
    114  
    115 struct CreatureItem 
    116 { 
    117     CreatureItem(uint32 _item, uint32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost) 
    118         : id(_item), count(_maxcount), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost), lastincr((uint32)time(NULL)) {} 
    119  
    120     uint32 id; 
    121     uint32 count; 
    122     uint32 maxcount; 
    123     uint32 incrtime; 
    124     uint32 lastincr; 
    125     uint32 ExtendedCost; 
    126113}; 
    127114 
     
    292279#endif 
    293280 
     281// Vendors 
     282struct VendorItem 
     283{ 
     284    VendorItem(uint32 _item, uint32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost) 
     285        : item(_item), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost) {} 
     286 
     287    uint32 item; 
     288    uint32 maxcount;                                        // 0 for infinity item amount 
     289    uint32 incrtime;                                        // time for restore items amount if maxcount != 0 
     290    uint32 ExtendedCost; 
     291}; 
     292typedef std::vector<VendorItem*> VendorItemList; 
     293 
     294struct VendorItemData 
     295{ 
     296    VendorItemList m_items; 
     297 
     298    VendorItem* GetItem(uint32 slot) const 
     299    { 
     300        if(slot>=m_items.size()) return NULL; 
     301        return m_items[slot]; 
     302    } 
     303    bool Empty() const { return m_items.empty(); } 
     304    uint8 GetItemCount() const { return m_items.size(); } 
     305    void AddItem( uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost) 
     306    { 
     307        m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost)); 
     308    } 
     309    bool RemoveItem( uint32 item_id ); 
     310    VendorItem const* FindItem(uint32 item_id) const; 
     311 
     312    void Clear() 
     313    { 
     314        for (VendorItemList::iterator itr = m_items.begin(); itr != m_items.end(); ++itr) 
     315            delete (*itr); 
     316    } 
     317}; 
     318 
     319struct VendorItemCount 
     320{ 
     321    explicit VendorItemCount(uint32 _item, uint32 _count) 
     322        : itemId(_item), count(_count), lastIncrementTime(time(NULL)) {} 
     323 
     324    uint32 itemId; 
     325    uint32 count; 
     326    time_t lastIncrementTime; 
     327}; 
     328 
     329typedef std::list<VendorItemCount> VendorItemCounts; 
     330 
    294331struct TrainerSpell 
    295332{ 
     
    419456        float GetSpellDamageMod(int32 Rank); 
    420457 
    421         /*********************************************************/ 
    422         /***                    VENDOR SYSTEM                  ***/ 
    423         /*********************************************************/ 
    424         void LoadGoods();                                   // must be called before access to vendor items, lazy loading at first call 
    425         void ReloadGoods() { m_itemsLoaded = false; LoadGoods(); } 
    426  
    427         CreatureItem* GetItem(uint32 slot) 
    428         { 
    429             if(slot>=m_vendor_items.size()) return NULL; 
    430             return &m_vendor_items[slot]; 
    431         } 
    432         uint8 GetItemCount() const { return m_vendor_items.size(); } 
    433         void AddItem( uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost) 
    434         { 
    435             m_vendor_items.push_back(CreatureItem(item, maxcount, ptime, ExtendedCost)); 
    436         } 
    437         bool RemoveItem( uint32 item_id ) 
    438         { 
    439             for(CreatureItems::iterator i = m_vendor_items.begin(); i != m_vendor_items.end(); ++i ) 
    440             { 
    441                 if(i->id==item_id) 
    442                 { 
    443                     m_vendor_items.erase(i); 
    444                     return true; 
    445                 } 
    446             } 
    447             return false; 
    448         } 
    449         CreatureItem* FindItem(uint32 item_id) 
    450         { 
    451             for(CreatureItems::iterator i = m_vendor_items.begin(); i != m_vendor_items.end(); ++i ) 
    452                 if(i->id==item_id) 
    453                     return &*i; 
    454             return NULL; 
    455         } 
     458        VendorItemData const* GetVendorItems() const; 
     459        uint32 GetVendorItemCurrentCount(VendorItem const* vItem); 
     460        uint32 UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 used_count); 
    456461 
    457462        TrainerSpellData const* GetTrainerSpells() const; 
     
    563568 
    564569        // vendor items 
    565         typedef std::vector<CreatureItem> CreatureItems; 
    566         CreatureItems m_vendor_items; 
    567         bool m_itemsLoaded;                                 // vendor items loading state 
     570        VendorItemCounts m_vendorItemCounts; 
    568571 
    569572        void _RealtimeSetCreatureInfo(); 
     
    593596        MovementGeneratorType m_defaultMovementType; 
    594597        Cell m_currentCell;                                 // store current cell where creature listed 
    595         uint32 m_DBTableGuid; 
     598        uint32 m_DBTableGuid;                               ///< For new or temporary creatures is 0 for saved it is lowguid 
    596599        uint32 m_equipmentId; 
    597600 
  • trunk/src/game/GameObject.cpp

    r2 r18  
    5555    m_cooldownTime = 0; 
    5656    m_goInfo = NULL; 
     57 
     58    m_DBTableGuid = 0; 
    5759} 
    5860 
     
    109111    Object::_Create(guidlow, goinfo->id, HIGHGUID_GAMEOBJECT); 
    110112 
    111     m_DBTableGuid = guidlow; 
    112113    m_goInfo = goinfo; 
    113114 
     
    479480void GameObject::SaveToDB() 
    480481{ 
    481     // this should only be used when the creature has already been loaded 
     482    // this should only be used when the gameobject has already been loaded 
    482483    // perferably after adding to map, because mapid may not be valid otherwise 
    483484    GameObjectData const *data = objmgr.GetGOData(m_DBTableGuid); 
     
    497498    if (!goI) 
    498499        return; 
    499  
     500     
     501    if (!m_DBTableGuid) 
     502        m_DBTableGuid = GetGUIDLow(); 
    500503    // update in loaded data (changing data only in this place) 
    501504    GameObjectData& data = objmgr.NewGOData(m_DBTableGuid); 
     
    567570    uint32 go_state = data->go_state; 
    568571 
    569     uint32 stored_guid = guid; 
     572    m_DBTableGuid = guid; 
    570573    if (map->GetInstanceId() != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); 
    571574 
    572575    if (!Create(guid,entry, map, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state) ) 
    573576        return false; 
    574  
    575     m_DBTableGuid = stored_guid; 
    576577 
    577578    switch(GetGOInfo()->type) 
     
    590591                m_spawnedByDefault = true; 
    591592                m_respawnDelayTime = data->spawntimesecs; 
    592                 m_respawnTime = objmgr.GetGORespawnTime(stored_guid, map->GetInstanceId()); 
     593                m_respawnTime = objmgr.GetGORespawnTime(m_DBTableGuid, map->GetInstanceId()); 
    593594 
    594595                                                            // ready to respawn 
     
    11591160            Player* player = (Player*)user; 
    11601161 
    1161             if( player->InBattleGround() &&                 // in battleground 
    1162                 !player->IsMounted() &&                     // not mounted 
    1163                 !player->HasStealthAura() &&                // not stealthed 
    1164                 !player->HasInvisibilityAura() &&           // not invisible 
    1165                 player->isAlive())                          // live player 
    1166             { 
     1162            if( player->isAllowUseBattleGroundObject() ) 
     1163            { 
     1164                // in battleground check 
    11671165                BattleGround *bg = player->GetBattleGround(); 
    11681166                if(!bg) 
     
    11871185            Player* player = (Player*)user; 
    11881186 
    1189             if( player->InBattleGround() &&                 // in battleground 
    1190                 !player->IsMounted() &&                     // not mounted 
    1191                 !player->HasStealthAura() &&                // not stealthed 
    1192                 !player->HasInvisibilityAura() &&           // not invisible 
    1193                 !player->HasAura(SPELL_RECENTLY_DROPPED_FLAG, 0) &&  // can't pickup 
    1194                 player->isAlive())                          // live player 
    1195             { 
     1187            if( player->isAllowUseBattleGroundObject() )      
     1188            { 
     1189                // in battleground check 
    11961190                BattleGround *bg = player->GetBattleGround(); 
    11971191                if(!bg) 
  • trunk/src/game/GameObject.h

    r2 r18  
    583583        uint32 m_usetimes; 
    584584 
    585         uint32 m_DBTableGuid; 
     585        uint32 m_DBTableGuid;                               ///< For new or temporary gameobjects is 0 for saved it is lowguid 
    586586        GameObjectInfo const* m_goInfo; 
    587587    private: 
  • trunk/src/game/GossipDef.cpp

    r6 r18  
    392392 
    393393    pSession->SendPacket( &data ); 
    394     //sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u",GUID_LOPART(npcGUID),questStatus); 
     394    sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u",GUID_LOPART(npcGUID),questStatus); 
    395395} 
    396396 
     
    478478    pSession->SendPacket( &data ); 
    479479 
    480     //sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u",GUID_LOPART(npcGUID),pQuest->GetQuestId()); 
     480    sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u",GUID_LOPART(npcGUID),pQuest->GetQuestId()); 
    481481} 
    482482 
     
    516516 
    517517    data << uint32(pQuest->GetQuestId()); 
    518     data << uint32(pQuest->GetMinLevel());                  // not MinLevel. Accepted values: 0, 1 or 2 Possible theory for future dev: 0==cannot in quest log, 1==can in quest log session only(removed on log out), 2==can in quest log always (save to db) 
     518    data << uint32(pQuest->GetQuestMethod());               // Accepted values: 0, 1 or 2. 0==IsAutoComplete() (skip objectives/details) 
    519519    data << uint32(pQuest->GetQuestLevel());                // may be 0 
    520520    data << uint32(pQuest->GetZoneOrSort());                // zone or sort to display in quest log 
     
    598598 
    599599    pSession->SendPacket( &data ); 
    600     //sLog.outDebug( "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u",pQuest->GetQuestId() ); 
     600    sLog.outDebug( "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u",pQuest->GetQuestId() ); 
    601601} 
    602602 
     
    680680    data << uint32(0);                                      // Honor points reward, not implemented 
    681681    pSession->SendPacket( &data ); 
    682     //sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u",GUID_LOPART(npcGUID),pQuest->GetQuestId() ); 
     682    sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u",GUID_LOPART(npcGUID),pQuest->GetQuestId() ); 
    683683} 
    684684 
     
    759759 
    760760    pSession->SendPacket( &data ); 
    761     //sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u",GUID_LOPART(npcGUID),pQuest->GetQuestId() ); 
    762 } 
     761    sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u",GUID_LOPART(npcGUID),pQuest->GetQuestId() ); 
     762} 
  • trunk/src/game/ItemHandler.cpp

    r2 r18  
    681681    // Stop the npc if moving 
    682682    pCreature->StopMoving(); 
    683     // load vendor items if not yet 
    684     pCreature->LoadGoods(); 
    685  
    686     uint8 numitems = pCreature->GetItemCount(); 
     683 
     684    VendorItemData const* vItems = pCreature->GetVendorItems(); 
     685    if(!vItems) 
     686    { 
     687        _player->SendSellError( SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0); 
     688        return; 
     689    } 
     690 
     691    uint8 numitems = vItems->GetItemCount(); 
    687692    uint8 count = 0; 
    688     uint32 ptime = time(NULL); 
    689     uint32 diff; 
    690693 
    691694    WorldPacket data( SMSG_LIST_INVENTORY, (8+1+numitems*8*4) ); 
     
    695698    float discountMod = _player->GetReputationPriceDiscount(pCreature); 
    696699 
    697     ItemPrototype const *pProto; 
    698700    for(int i = 0; i < numitems; i++ ) 
    699701    { 
    700         CreatureItem* crItem = pCreature->GetItem(i); 
    701         if( crItem ) 
    702         { 
    703             pProto = objmgr.GetItemPrototype(crItem->id); 
    704             if( pProto ) 
     702        if(VendorItem const* crItem = vItems->GetItem(i)) 
     703        { 
     704            if(ItemPrototype const *pProto = objmgr.GetItemPrototype(crItem->item)) 
    705705            { 
    706706                if((pProto->AllowableClass & _player->getClassMask()) == 0 && pProto->Bonding == BIND_WHEN_PICKED_UP && !_player->isGameMaster()) 
    707707                    continue; 
     708 
    708709                ++count; 
    709                 if( crItem->incrtime != 0 && (crItem->lastincr + crItem->incrtime <= ptime) ) 
    710                 { 
    711                     diff = uint32((ptime - crItem->lastincr)/crItem->incrtime); 
    712                     if( (crItem->count + diff * pProto->BuyCount) <= crItem->maxcount ) 
    713                         crItem->count += diff * pProto->BuyCount; 
    714                     else 
    715                         crItem->count = crItem->maxcount; 
    716                     crItem->lastincr = ptime; 
    717                 } 
     710 
     711                // reputation discount 
     712                uint32 price = uint32(floor(pProto->BuyPrice * discountMod)); 
     713 
    718714                data << uint32(count); 
    719                 data << uint32(crItem->id); 
     715                data << uint32(crItem->item); 
    720716                data << uint32(pProto->DisplayInfoID); 
    721                 data << uint32(crItem->maxcount <= 0 ? 0xFFFFFFFF : crItem->count); 
    722  
    723                 uint32 price = pProto->BuyPrice; 
    724  
    725                 // reputation discount 
    726                 price = uint32(floor(pProto->BuyPrice * discountMod)); 
    727  
     717                data << uint32(crItem->maxcount <= 0 ? 0xFFFFFFFF : pCreature->GetVendorItemCurrentCount(crItem)); 
    728718                data << uint32(price); 
    729719                data << uint32(pProto->MaxDurability); 
  • trunk/src/game/Language.h

    r9 r18  
    304304    LANG_LOOKUP_PLAYER_CHARACTER        = 329, 
    305305    LANG_NO_PLAYERS_FOUND               = 330, 
     306    LANG_EXTENDED_COST_NOT_EXIST        = 331, 
    306307 
    307308    // Room for more level 2 
  • trunk/src/game/Level2.cpp

    r6 r18  
    12381238        return false; 
    12391239 
    1240     Creature* vendor = getSelectedCreature(); 
    1241     if (!vendor || !vendor->isVendor()) 
    1242     { 
    1243         SendSysMessage(LANG_COMMAND_VENDORSELECTION); 
    1244         SetSentErrorMessage(true); 
    1245         return false; 
    1246     } 
    1247  
    12481240    char* pitem  = extractKeyFromLink((char*)args,"Hitem"); 
    12491241    if (!pitem) 
     
    12531245        return false; 
    12541246    } 
     1247 
    12551248    uint32 itemId = atol(pitem); 
    12561249 
     
    12681261    uint32 extendedcost = fextendedcost ? atol(fextendedcost) : 0; 
    12691262 
    1270     ItemPrototype const *pProto = objmgr.GetItemPrototype(itemId); 
    1271     if(!pProto) 
    1272     { 
    1273         PSendSysMessage(LANG_ITEM_NOT_FOUND, itemId); 
    1274         SetSentErrorMessage(true); 
    1275         return false; 
    1276     } 
    1277  
    1278     if(extendedcost && !sItemExtendedCostStore.LookupEntry(extendedcost)) 
    1279     { 
    1280         PSendSysMessage(LANG_BAD_VALUE, extendedcost); 
    1281         SetSentErrorMessage(true); 
    1282         return false; 
    1283     } 
    1284  
    1285     // load vendor items if not yet 
    1286     vendor->LoadGoods(); 
    1287  
    1288     if(vendor->FindItem(itemId)) 
    1289     { 
    1290         PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST,itemId); 
    1291         SetSentErrorMessage(true); 
    1292         return false; 
    1293     } 
    1294  
    1295     if (vendor->GetItemCount() >= MAX_VENDOR_ITEMS) 
    1296     { 
    1297         SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS); 
    1298         SetSentErrorMessage(true); 
    1299         return false; 
    1300     } 
    1301  
    1302     // add to DB and to current ingame vendor 
    1303     WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",vendor->GetEntry(), itemId, maxcount,incrtime,extendedcost); 
    1304     vendor->AddItem(itemId,maxcount,incrtime,extendedcost); 
     1263    Creature* vendor = getSelectedCreature(); 
     1264 
     1265    uint32 vendor_entry = vendor ? vendor->GetEntry() : 0; 
     1266 
     1267    if(!objmgr.IsVendorItemValid(vendor_entry,itemId,maxcount,incrtime,extendedcost,m_session->GetPlayer())) 
     1268    { 
     1269        SetSentErrorMessage(true); 
     1270        return false; 
     1271    } 
     1272 
     1273    objmgr.AddVendorItem(vendor_entry,itemId,maxcount,incrtime,extendedcost); 
     1274 
     1275    ItemPrototype const* pProto = objmgr.GetItemPrototype(itemId); 
     1276 
    13051277    PSendSysMessage(LANG_ITEM_ADDED_TO_LIST,itemId,pProto->Name1,maxcount,incrtime,extendedcost); 
    13061278    return true; 
     
    13301302    uint32 itemId = atol(pitem); 
    13311303 
    1332     ItemPrototype const *pProto = objmgr.GetItemPrototype(itemId); 
    1333     if(!pProto) 
    1334     { 
    1335         PSendSysMessage(LANG_ITEM_NOT_FOUND, itemId); 
    1336         SetSentErrorMessage(true); 
    1337         return false; 
    1338     } 
    1339  
    1340     // load vendor items if not yet 
    1341     vendor->LoadGoods(); 
    1342  
    1343     if (!vendor->RemoveItem(itemId)) 
     1304 
     1305    if(!objmgr.RemoveVendorItem(vendor->GetEntry(),itemId)) 
    13441306    { 
    13451307        PSendSysMessage(LANG_ITEM_NOT_IN_LIST,itemId); 
     
    13481310    } 
    13491311 
    1350     WorldDatabase.PExecuteLog("DELETE FROM npc_vendor WHERE entry='%u' AND item='%u'",vendor->GetEntry(), itemId); 
     1312    ItemPrototype const* pProto = objmgr.GetItemPrototype(itemId); 
     1313 
    13511314    PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST,itemId,pProto->Name1); 
    13521315    return true; 
  • trunk/src/game/ObjectMgr.cpp

    r6 r18  
    7171} 
    7272 
     73LanguageDesc lang_description[LANGUAGES_COUNT] = 
     74{ 
     75    { LANG_ADDON,           0, 0                       }, 
     76    { LANG_UNIVERSAL,       0, 0                       }, 
     77    { LANG_ORCISH,        669, SKILL_LANG_ORCISH       }, 
     78    { LANG_DARNASSIAN,    671, SKILL_LANG_DARNASSIAN   }, 
     79    { LANG_TAURAHE,       670, SKILL_LANG_TAURAHE      }, 
     80    { LANG_DWARVISH,      672, SKILL_LANG_DWARVEN      }, 
     81    { LANG_COMMON,        668, SKILL_LANG_COMMON       }, 
     82    { LANG_DEMONIC,       815, SKILL_LANG_DEMON_TONGUE }, 
     83    { LANG_TITAN,         816, SKILL_LANG_TITAN        }, 
     84    { LANG_THALASSIAN,    813, SKILL_LANG_THALASSIAN   }, 
     85    { LANG_DRACONIC,      814, SKILL_LANG_DRACONIC     }, 
     86    { LANG_KALIMAG,       817, SKILL_LANG_OLD_TONGUE   }, 
     87    { LANG_GNOMISH,      7340, SKILL_LANG_GNOMISH      }, 
     88    { LANG_TROLL,        7341, SKILL_LANG_TROLL        }, 
     89    { LANG_GUTTERSPEAK, 17737, SKILL_LANG_GUTTERSPEAK  }, 
     90    { LANG_DRAENEI,     29932, SKILL_LANG_DRAENEI      }, 
     91    { LANG_ZOMBIE,          0, 0                       }, 
     92    { LANG_GNOMISH_BINARY,  0, 0                       }, 
     93    { LANG_GOBLIN_BINARY,   0, 0                       } 
     94}; 
     95 
     96LanguageDesc const* GetLanguageDescByID(uint32 lang) 
     97{ 
     98    for(int i = 0; i < LANGUAGES_COUNT; ++i) 
     99    { 
     100        if(uint32(lang_description[i].lang_id) == lang) 
     101            return &lang_description[i]; 
     102    } 
     103 
     104    return NULL; 
     105} 
     106 
    73107ObjectMgr::ObjectMgr() 
    74108{ 
     
    135169 
    136170    for (CacheVendorItemMap::iterator itr = m_mCacheVendorItemMap.begin(); itr != m_mCacheVendorItemMap.end(); ++itr) 
    137         for (VendorItemList::iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2) 
    138             delete (*itr2); 
     171        itr->second.Clear(); 
    139172 
    140173    for (CacheTrainerSpellMap::iterator itr = m_mCacheTrainerSpellMap.begin(); itr != m_mCacheTrainerSpellMap.end(); ++itr) 
     
    26982731    mExclusiveQuestGroups.clear(); 
    26992732 
    2700     //                                                0      1           2             3         4           5     6              7 
    2701     QueryResult *result = WorldDatabase.Query("SELECT entry, ZoneOrSort, SkillOrClass, MinLevel, QuestLevel, Type, RequiredRaces, RequiredSkillValue," 
    2702     //   8                    9                  10                     11                   12                     13                   14                15 
     2733    //                                                0      1       2           3             4         5           6     7              8 
     2734    QueryResult *result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, SkillOrClass, MinLevel, QuestLevel, Type, RequiredRaces, RequiredSkillValue," 
     2735    //   9                    10                 11                     12                   13                     14                   15                16 
    27032736        "RepObjectiveFaction, RepObjectiveValue, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime," 
    2704     //   16          17            18           19           20           21              22                23         24            25 
     2737    //   17          18            19           20           21           22              23                24         25            26 
    27052738        "QuestFlags, SpecialFlags, CharTitleId, PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestInChain, SrcItemId, SrcItemCount, SrcSpell," 
    2706     //   26     27       28          29               30                31       32              33              34              35 
     2739    //   27     28       29          30               31                32       33              34              35              36 
    27072740        "Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4," 
    2708     //   36          37          38          39          40             41             42             43 
     2741    //   37          38          39          40          41             42             43             44 
    27092742        "ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4," 
    2710     //   44            45            46            47            48               49               50               51               52             53             54             55 
     2743    //   45            46            47            48            49               50               51               52               53             54             54             55 
    27112744        "ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4, ReqSourceRef1, ReqSourceRef2, ReqSourceRef3, ReqSourceRef4," 
    2712     //   56                  57                  58                  59                  60                     61                     62                     63 
     2745    //   57                  58                  59                  60                  61                     62                     63                     64 
    27132746        "ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4," 
    2714     //   64             65             66             67 
     2747    //   65             66             67             68 
    27152748        "ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4," 
    2716     //   68                69                70                71                72                73 
     2749    //   69                70                71                72                73                74 
    27172750        "RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6," 
    2718     //   74                   75                   76                   77                   78                   79 
     2751    //   75                   76                   77                   78                   79                   80 
    27192752        "RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6," 
    2720     //   80          81          82          83          84             85             86             87 
     2753    //   81          82          83          84          85             86             87             88 
    27212754        "RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4," 
    2722     //   88              89              90              91              92              93            94            95            96            97 
     2755    //   89              90              91              92              93              94            95            96            97            98 
    27232756        "RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5," 
    2724     //   98             99                100       101           102                103               104         105     106     107 
     2757    //   99             100               101       102           103                104               105         106     107     108 
    27252758        "RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt," 
    2726     //   108            109            110            111           112              113            114                115                116                117 
     2759    //   109            110            111            112           113              114            115                116                117                118 
    27272760        "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4,IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4," 
    2728     //   118          119 
     2761    //   119          120 
    27292762        "StartScript, CompleteScript" 
    27302763        " FROM quest_template"); 
     
    27612794 
    27622795        // additional quest integrity checks (GO, creature_template and item_template must be loaded already) 
     2796 
     2797        if( qinfo->GetQuestMethod() >= 3 ) 
     2798        { 
     2799            sLog.outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.",qinfo->GetQuestId(),qinfo->GetQuestMethod()); 
     2800        } 
    27632801 
    27642802        if (qinfo->QuestFlags & ~QUEST_MANGOS_FLAGS_DB_ALLOWED) 
     
    61496187        if(entry==0) 
    61506188        { 
    6151             sLog.outString("Table `%s` contain reserved entry 0, ignored.",table); 
     6189            sLog.outErrorDb("Table `%s` contain reserved entry 0, ignored.",table); 
    61526190            continue; 
    61536191        } 
     
    61566194            int32 start = min_value > 0 ? min_value : max_value; 
    61576195            int32 end   = min_value > 0 ? max_value : min_value; 
    6158             sLog.outString("Table `%s` contain entry %i out of allowed range (%d - %d), ignored.",table,entry,start,end); 
     6196            sLog.outErrorDb("Table `%s` contain entry %i out of allowed range (%d - %d), ignored.",table,entry,start,end); 
    61596197            continue; 
    61606198        } 
     
    61646202        if(data.Content.size() > 0) 
    61656203        { 
    6166             sLog.outString("Table `%s` contain data for already loaded entry  %i (from another table?), ignored.",table,entry); 
     6204            sLog.outErrorDb("Table `%s` contain data for already loaded entry  %i (from another table?), ignored.",table,entry); 
    61676205            continue; 
    61686206        } 
     
    66576695    barGoLink bar( result->GetRowCount() ); 
    66586696 
    6659     uint32 count = 0,entry,spell; 
     6697    uint32 count = 0; 
    66606698    do 
    66616699    { 
     
    66646702        Field* fields = result->Fetch(); 
    66656703 
    6666         entry  = fields[0].GetUInt32(); 
    6667         spell  = fields[1].GetUInt32(); 
    6668  
    6669         if(!GetCreatureTemplate(entry)) 
     6704        uint32 entry  = fields[0].GetUInt32(); 
     6705        uint32 spell  = fields[1].GetUInt32(); 
     6706 
     6707        CreatureInfo const* cInfo = GetCreatureTemplate(entry); 
     6708 
     6709        if(!cInfo) 
    66706710        { 
    66716711            sLog.outErrorDb("Table `npc_trainer` have entry for not existed creature template (Entry: %u), ignore", entry); 
     6712            continue; 
     6713        } 
     6714 
     6715        if(!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER)) 
     6716        { 
     6717            sLog.outErrorDb("Table `npc_trainer` have data for not creature template (Entry: %u) without trainer flag, ignore", entry); 
    66726718            continue; 
    66736719        } 
     
    67166762    // For reload case  
    67176763    for (CacheVendorItemMap::iterator itr = m_mCacheVendorItemMap.begin(); itr != m_mCacheVendorItemMap.end(); ++itr) 
    6718     { 
    6719         for (VendorItemList::iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2) 
    6720             delete (*itr2); 
    6721     } 
     6764        itr->second.Clear(); 
    67226765    m_mCacheVendorItemMap.clear(); 
    67236766 
     
    67376780 
    67386781    uint32 count = 0; 
    6739     uint32 entry, item_id, ExtendedCost; 
    67406782    do 
    67416783    { 
     
    67436785        Field* fields = result->Fetch(); 
    67446786 
    6745         entry = fields[0].GetUInt32(); 
    6746         if(!GetCreatureTemplate(entry)) 
    6747         { 
    6748             sLog.outErrorDb("Table `npc_vendor` have data for not existed creature template (Entry: %u), ignore", entry); 
     6787        uint32 entry        = fields[0].GetUInt32(); 
     6788        uint32 item_id      = fields[1].GetUInt32(); 
     6789        uint32 maxcount     = fields[2].GetUInt32(); 
     6790        uint32 incrtime     = fields[3].GetUInt32(); 
     6791        uint32 ExtendedCost = fields[4].GetUInt32(); 
     6792 
     6793        if(!IsVendorItemValid(entry,item_id,maxcount,incrtime,ExtendedCost)) 
    67496794            continue; 
    6750         } 
    6751  
    6752         item_id  = fields[1].GetUInt32(); 
    6753         if(!GetItemPrototype(item_id)) 
    6754         { 
    6755             sLog.outErrorDb("Table `npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore",entry,item_id); 
    6756             continue; 
    6757         } 
    6758  
    6759         ExtendedCost = fields[4].GetUInt32(); 
    6760         if(ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost)) 
    6761         { 
    6762             sLog.outErrorDb("Table `npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore",item_id,ExtendedCost,entry); 
    6763             continue; 
    6764         } 
    6765  
    6766         VendorItemList& vList = m_mCacheVendorItemMap[entry]; 
    6767  
    6768         if(vList.size() >= MAX_VENDOR_ITEMS) 
    6769         { 
    6770             sLog.outErrorDb( "Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vList.size(), MAX_VENDOR_ITEMS, entry); 
    6771             continue; 
    6772         } 
    6773  
    6774         VendorItem* pVendorItem = new VendorItem(); 
    6775         pVendorItem->item         = item_id; 
    6776         pVendorItem->maxcount     = fields[2].GetUInt32(); 
    6777         pVendorItem->incrtime     = fields[3].GetUInt32(); 
    6778         pVendorItem->ExtendedCost = ExtendedCost; 
    6779  
    6780         vList.push_back(pVendorItem); 
     6795 
     6796        VendorItemData& vList = m_mCacheVendorItemMap[entry]; 
     6797 
     6798        vList.AddItem(item_id,maxcount,incrtime,ExtendedCost); 
    67816799        ++count; 
    67826800 
     
    68396857} 
    68406858 
     6859void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 extendedcost ) 
     6860{ 
     6861    VendorItemData& vList = m_mCacheVendorItemMap[entry]; 
     6862    vList.AddItem(item,maxcount,incrtime,extendedcost); 
     6863 
     6864    WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",entry, item, maxcount,incrtime,extendedcost); 
     6865} 
     6866 
     6867bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item ) 
     6868{ 
     6869    CacheVendorItemMap::iterator  iter = m_mCacheVendorItemMap.find(entry); 
     6870    if(iter == m_mCacheVendorItemMap.end()) 
     6871        return false; 
     6872 
     6873    if(!iter->second.FindItem(item)) 
     6874        return false; 
     6875 
     6876    iter->second.RemoveItem(item); 
     6877    WorldDatabase.PExecuteLog("DELETE FROM npc_vendor WHERE entry='%u' AND item='%u'",entry, item); 
     6878    return true; 
     6879} 
     6880 
     6881bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl ) const 
     6882{ 
     6883    CreatureInfo const* cInfo = GetCreatureTemplate(vendor_entry); 
     6884    if(!cInfo) 
     6885    { 
     6886        if(pl) 
     6887            ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION); 
     6888        else 
     6889            sLog.outErrorDb("Table `npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry); 
     6890        return false; 
     6891    } 
     6892 
     6893    if(!(cInfo->npcflag & UNIT_NPC_FLAG_VENDOR)) 
     6894    { 
     6895        if(pl) 
     6896            ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION); 
     6897        else 
     6898            sLog.outErrorDb("Table `npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry); 
     6899        return false; 
     6900    } 
     6901 
     6902    if(!GetItemPrototype(item_id)) 
     6903    { 
     6904        if(pl) 
     6905            ChatHandler(pl).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id); 
     6906        else 
     6907            sLog.outErrorDb("Table `npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore",vendor_entry,item_id); 
     6908        return false; 
     6909    } 
     6910 
     6911    if(ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost)) 
     6912    { 
     6913        if(pl) 
     6914            ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST,ExtendedCost); 
     6915        else 
     6916            sLog.outErrorDb("Table `npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore",item_id,ExtendedCost,vendor_entry); 
     6917        return false; 
     6918    } 
     6919 
     6920    if(maxcount > 0 && incrtime == 0) 
     6921    { 
     6922        if(pl) 
     6923            ChatHandler(pl).PSendSysMessage("MaxCount!=0 (%u) but IncrTime==0", maxcount); 
     6924        else 
     6925            sLog.outErrorDb( "Table `npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry); 
     6926        return false; 
     6927    } 
     6928    else if(maxcount==0 && incrtime > 0) 
     6929    { 
     6930        if(pl) 
     6931            ChatHandler(pl).PSendSysMessage("MaxCount==0 but IncrTime<>=0"); 
     6932        else 
     6933            sLog.outErrorDb( "Table `npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry); 
     6934        return false; 
     6935    } 
     6936 
     6937    VendorItemData const* vItems = GetNpcVendorItemList(vendor_entry); 
     6938    if(!vItems) 
     6939        return true;                                        // later checks for non-empty lists 
     6940 
     6941    if(vItems->FindItem(item_id)) 
     6942    { 
     6943        if(pl) 
     6944            ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST,item_id); 
     6945        else 
     6946            sLog.outErrorDb( "Table `npc_vendor` has duplicate items %u for vendor (Entry: %u), ignore", item_id, vendor_entry); 
     6947        return false; 
     6948    } 
     6949 
     6950    if(vItems->GetItemCount() >= MAX_VENDOR_ITEMS) 
     6951    { 
     6952        if(pl) 
     6953            ChatHandler(pl).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS); 
     6954        else 
     6955            sLog.outErrorDb( "Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry); 
     6956        return false; 
     6957    } 
     6958 
     6959    return true; 
     6960} 
     6961 
    68416962// Functions for scripting access 
    68426963const char* GetAreaTriggerScriptNameById(uint32 id) 
     
    68496970    if(start_value >= 0 || start_value <= end_value)        // start/end reversed for negative values 
    68506971    { 
    6851         sLog.outError("Table '%s' attempt loaded with invalid range (%d - %d), use (%d - %d) instead.",table,start_value,end_value,-1,std::numeric_limits<int32>::min()); 
     6972        sLog.outErrorDb("Table '%s' attempt loaded with invalid range (%d - %d), use (%d - %d) instead.",table,start_value,end_value,-1,std::numeric_limits<int32>::min()); 
    68526973        start_value = -1; 
    68536974        end_value = std::numeric_limits<int32>::min(); 
  • trunk/src/game/ObjectMgr.h

    r9 r18  
    229229typedef HM_NAMESPACE::hash_map<uint32, uint32> CacheNpcTextIdMap; 
    230230 
    231 // Vendors 
    232 struct VendorItem 
    233 { 
    234     uint32 item; 
    235     uint32 maxcount; 
    236     uint32 incrtime; 
    237     uint32 ExtendedCost; 
    238 }; 
    239 typedef std::vector<VendorItem*> VendorItemList; 
    240  
    241 typedef HM_NAMESPACE::hash_map<uint32, VendorItemList> CacheVendorItemMap; 
    242  
     231 
     232typedef HM_NAMESPACE::hash_map<uint32, VendorItemData> CacheVendorItemMap; 
    243233typedef HM_NAMESPACE::hash_map<uint32, TrainerSpellData> CacheTrainerSpellMap; 
    244234 
     
    258248 
    259249bool normalizePlayerName(std::string& name); 
     250 
     251struct MANGOS_DLL_SPEC LanguageDesc 
     252{ 
     253    Language lang_id; 
     254    uint32   spell_id; 
     255    uint32   skill_id; 
     256}; 
     257 
     258extern LanguageDesc lang_description[LANGUAGES_COUNT]; 
     259MANGOS_DLL_SPEC LanguageDesc const* GetLanguageDescByID(uint32 lang); 
    260260 
    261261class PlayerDumpReader; 
     
    733733        } 
    734734 
    735         VendorItemList const* GetNpcVendorItemList(uint32 entry) const 
     735        VendorItemData const* GetNpcVendorItemList(uint32 entry) const 
    736736        { 
    737737            CacheVendorItemMap::const_iterator  iter = m_mCacheVendorItemMap.find(entry); 
     
    741741            return &iter->second; 
    742742        } 
     743        void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost); 
     744        bool RemoveVendorItem(uint32 entry,uint32 item); 
     745        bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL ) const; 
    743746    protected: 
    744747        uint32 m_auctionid; 
  • trunk/src/game/Pet.cpp

    r2 r18  
    17431743    if(auraId == 35696)                                       // Demonic Knowledge 
    17441744    { 
    1745         int32 basePoints = aura->GetDamage() * (GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT)) / 100; 
     1745        int32 basePoints = int32(aura->GetDamage() * (GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT)) / 100); 
    17461746        CastCustomSpell(this,auraId,&basePoints, NULL, NULL, true ); 
    17471747    } 
  • trunk/src/game/Player.cpp

    r12 r18  
    57955795        return; 
    57965796 
    5797     ReputationOnKillEntry const* Rep = objmgr.GetReputationOnKilEntry(pVictim->GetEntry()); 
     5797    ReputationOnKillEntry const* Rep = objmgr.GetReputationOnKilEntry(((Creature*)pVictim)->GetCreatureInfo()->Entry); 
    57985798 
    57995799    if(!Rep) 
     
    1638116381    } 
    1638216382 
    16383     // load vendor items if not yet 
    16384     pCreature->LoadGoods(); 
    16385  
    16386     CreatureItem* crItem = pCreature->FindItem(item); 
    16387     if(!crItem) 
     16383    VendorItemData const* vItems = pCreature->GetVendorItems(); 
     16384    if(!vItems || vItems->Empty()) 
    1638816385    { 
    1638916386        SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0); 
     
    1639116388    } 
    1639216389 
    16393     if( crItem->maxcount != 0 && crItem->count < count ) 
    16394     { 
    16395         SendBuyError( BUY_ERR_ITEM_ALREADY_SOLD, pCreature, item, 0); 
     16390    VendorItem const* crItem = vItems->FindItem(item); 
     16391    if(!crItem) 
     16392    { 
     16393        SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0); 
    1639616394        return false; 
     16395    } 
     16396 
     16397    // check current item amount if it limited 
     16398    if( crItem->maxcount != 0 ) 
     16399    { 
     16400        if(pCreature->GetVendorItemCurrentCount(crItem) < pProto->BuyCount * count ) 
     16401        { 
     16402            SendBuyError( BUY_ERR_ITEM_ALREADY_SOLD, pCreature, item, 0); 
     16403            return false; 
     16404        } 
    1639716405    } 
    1639816406 
     
    1650916517        if(Item *it = StoreNewItem( dest, item, true )) 
    1651016518        { 
    16511             if( crItem->maxcount != 0 ) 
    16512                 crItem->count -= pProto->BuyCount * count; 
     16519            uint32 new_count = pCreature->UpdateVendorItemCurrentCount(crItem,pProto->BuyCount * count); 
    1651316520 
    1651416521            WorldPacket data(SMSG_BUY_ITEM, (8+4+4+4)); 
    1651516522            data << pCreature->GetGUID(); 
    16516             data << (uint32)crItem->id;                     // entry 
    16517             data << (uint32)crItem->count; 
     16523            data << (uint32)crItem->item; 
     16524            data << (uint32)(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); 
    1651816525            data << (uint32)count; 
    1651916526            GetSession()->SendPacket(&data); 
    1652016527 
    16521             SendNewItem(it, count, true, false, false); 
     16528            SendNewItem(it, pProto->BuyCount*count, true, false, false); 
    1652216529        } 
    1652316530    } 
     
    1654916556        if(Item *it = EquipNewItem( dest, item, pProto->BuyCount * count, true )) 
    1655016557        { 
    16551             if( crItem->maxcount != 0 ) 
    16552                 crItem->count -= pProto->BuyCount * count; 
     16558            uint32 new_count = pCreature->UpdateVendorItemCurrentCount(crItem,pProto->BuyCount * count); 
    1655316559 
    1655416560            WorldPacket data(SMSG_BUY_ITEM, (8+4+4+4)); 
    1655516561            data << pCreature->GetGUID(); 
    16556             data << (uint32)crItem->id;                     // entry 
    16557             data << (uint32)crItem->count; 
     16562            data << (uint32)crItem->item; 
     16563            data << (uint32)(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); 
    1655816564            data << (uint32)count; 
    1655916565            GetSession()->SendPacket(&data); 
    1656016566 
    16561             SendNewItem(it, count, true, false, false); 
     16567            SendNewItem(it, pProto->BuyCount*count, true, false, false); 
    1656216568 
    1656316569            AutoUnequipOffhandIfNeed(); 
     
    1657016576    } 
    1657116577 
    16572     return crItem->maxcount!=0?true:false; 
     16578    return crItem->maxcount!=0; 
    1657316579} 
    1657416580 
     
    1717517181    // set fly flag if in fly form or taxi flight to prevent visually drop at ground in showup moment 
    1717617182    if(HasAuraType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED) || isInFlight()) 
    17177         SetUnitMovementFlags(GetUnitMovementFlags() | MOVEMENTFLAG_FLYING2); 
     17183        AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); 
    1717817184} 
    1717917185 
     
    1816818174    return false; 
    1816918175} 
     18176 
     18177bool Player::isAllowUseBattleGroundObject() 
     18178{ 
     18179    return ( //InBattleGround() &&                            // in battleground - not need, check in other cases 
     18180             !IsMounted() &&                                  // not mounted 
     18181             !HasStealthAura() &&                             // not stealthed 
     18182             !HasInvisibilityAura() &&                        // not invisible 
     18183             !HasAura(SPELL_RECENTLY_DROPPED_FLAG, 0) &&      // can't pickup 
     18184             isAlive()                                        // live player 
     18185           ); 
     18186} 
  • trunk/src/game/Player.h

    r12 r18  
    18991899 
    19001900        bool GetBGAccessByLevel(uint32 bgTypeId) const; 
     1901        bool isAllowUseBattleGroundObject(); 
    19011902 
    19021903        /*********************************************************/ 
  • trunk/src/game/PointMovementGenerator.cpp

    r2 r18  
    3131    Traveller<T> traveller(unit); 
    3232    i_destinationHolder.SetDestination(traveller,i_x,i_y,i_z); 
     33     
     34    if (unit.GetTypeId() == TYPEID_UNIT && ((Creature*)&unit)->canFly()) 
     35        unit.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); 
    3336} 
    3437 
  • trunk/src/game/QuestDef.cpp

    r2 r18  
    2424{ 
    2525    QuestId = questRecord[0].GetUInt32(); 
    26     ZoneOrSort = questRecord[1].GetInt32(); 
    27     SkillOrClass = questRecord[2].GetInt32(); 
    28     MinLevel = questRecord[3].GetUInt32(); 
    29     QuestLevel = questRecord[4].GetUInt32(); 
    30     Type = questRecord[5].GetUInt32(); 
    31     RequiredRaces = questRecord[6].GetUInt32(); 
    32     RequiredSkillValue = questRecord[7].GetUInt32(); 
    33     RepObjectiveFaction = questRecord[8].GetUInt32(); 
    34     RepObjectiveValue = questRecord[9].GetInt32(); 
    35     RequiredMinRepFaction = questRecord[10].GetUInt32(); 
    36     RequiredMinRepValue = questRecord[11].GetInt32(); 
    37     RequiredMaxRepFaction = questRecord[12].GetUInt32(); 
    38     RequiredMaxRepValue = questRecord[13].GetInt32(); 
    39     SuggestedPlayers = questRecord[14].GetUInt32(); 
    40     LimitTime = questRecord[15].GetUInt32(); 
    41     QuestFlags = questRecord[16].GetUInt16(); 
    42     uint32 SpecialFlags = questRecord[17].GetUInt16(); 
    43     CharTitleId = questRecord[18].GetUInt32(); 
    44     PrevQuestId = questRecord[19].GetInt32(); 
    45     NextQuestId = questRecord[20].GetInt32(); 
    46     ExclusiveGroup = questRecord[21].GetInt32(); 
    47     NextQuestInChain = questRecord[22].GetUInt32(); 
    48     SrcItemId = questRecord[23].GetUInt32(); 
    49     SrcItemCount = questRecord[24].GetUInt32(); 
    50     SrcSpell = questRecord[25].GetUInt32(); 
    51     Title = questRecord[26].GetCppString(); 
    52     Details = questRecord[27].GetCppString(); 
    53     Objectives = questRecord[28].GetCppString(); 
    54     OfferRewardText = questRecord[29].GetCppString(); 
    55     RequestItemsText = questRecord[30].GetCppString(); 
    56     EndText = questRecord[31].GetCppString(); 
    57  
    58     for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) 
    59         ObjectiveText[i] = questRecord[32+i].GetCppString(); 
    60  
    61     for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) 
    62         ReqItemId[i] = questRecord[36+i].GetUInt32(); 
    63  
    64     for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) 
    65         ReqItemCount[i] = questRecord[40+i].GetUInt32(); 
     26    QuestMethod = questRecord[1].GetUInt32(); 
     27    ZoneOrSort = questRecord[2].GetInt32(); 
     28    SkillOrClass = questRecord[3].GetInt32(); 
     29    MinLevel = questRecord[4].GetUInt32(); 
     30    QuestLevel = questRecord[5].GetUInt32(); 
     31    Type = questRecord[6].GetUInt32(); 
     32    RequiredRaces = questRecord[7].GetUInt32(); 
     33    RequiredSkillValue = questRecord[8].GetUInt32(); 
     34    RepObjectiveFaction = questRecord[9].GetUInt32(); 
     35    RepObjectiveValue = questRecord[10].GetInt32(); 
     36    RequiredMinRepFaction = questRecord[11].GetUInt32(); 
     37    RequiredMinRepValue = questRecord[12].GetInt32(); 
     38    RequiredMaxRepFaction = questRecord[13].GetUInt32(); 
     39    RequiredMaxRepValue = questRecord[14].GetInt32(); 
     40    SuggestedPlayers = questRecord[15].GetUInt32(); 
     41    LimitTime = questRecord[16].GetUInt32(); 
     42    QuestFlags = questRecord[17].GetUInt16(); 
     43    uint32 SpecialFlags = questRecord[18].GetUInt16(); 
     44    CharTitleId = questRecord[19].GetUInt32(); 
     45    PrevQuestId = questRecord[20].GetInt32(); 
     46    NextQuestId = questRecord[21].GetInt32(); 
     47    ExclusiveGroup = questRecord[22].GetInt32(); 
     48    NextQuestInChain = questRecord[23].GetUInt32(); 
     49    SrcItemId = questRecord[24].GetUInt32(); 
     50    SrcItemCount = questRecord[25].GetUInt32(); 
     51    SrcSpell = questRecord[26].GetUInt32(); 
     52    Title = questRecord[27].GetCppString(); 
     53    Details = questRecord[28].GetCppString(); 
     54    Objectives = questRecord[29].GetCppString(); 
     55    OfferRewardText = questRecord[30].GetCppString(); 
     56    RequestItemsText = questRecord[31].GetCppString(); 
     57    EndText = questRecord[32].GetCppString(); 
     58 
     59    for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) 
     60        ObjectiveText[i] = questRecord[33+i].GetCppString(); 
     61 
     62    for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) 
     63        ReqItemId[i] = questRecord[37+i].GetUInt32(); 
     64 
     65    for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) 
     66        ReqItemCount[i] = questRecord[41+i].GetUInt32(); 
    6667 
    6768    for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) 
    68         ReqSourceId[i] = questRecord[44+i].GetUInt32(); 
     69        ReqSourceId[i] = questRecord[45+i].GetUInt32(); 
    6970 
    7071    for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) 
    71         ReqSourceCount[i] = questRecord[48+i].GetUInt32(); 
     72        ReqSourceCount[i] = questRecord[49+i].GetUInt32(); 
    7273 
    7374    for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) 
    74         ReqSourceRef[i] = questRecord[52+i].GetUInt32(); 
    75  
    76     for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) 
    77         ReqCreatureOrGOId[i] = questRecord[56+i].GetInt32(); 
    78  
    79     for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) 
    80         ReqCreatureOrGOCount[i] = questRecord[60+i].GetUInt32(); 
    81  
    82     for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) 
    83         ReqSpell[i] = questRecord[64+i].GetUInt32(); 
     75        ReqSourceRef[i] = questRecord[53+i].GetUInt32(); 
     76 
     77    for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) 
     78        ReqCreatureOrGOId[i] = questRecord[57+i].GetInt32(); 
     79 
     80    for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) 
     81        ReqCreatureOrGOCount[i] = questRecord[61+i].GetUInt32(); 
     82 
     83    for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) 
     84        ReqSpell[i] = questRecord[65+i].GetUInt32(); 
    8485 
    8586    for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) 
    86         RewChoiceItemId[i] = questRecord[68+i].GetUInt32(); 
     87        RewChoiceItemId[i] = questRecord[69+i].GetUInt32(); 
    8788 
    8889    for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) 
    89         RewChoiceItemCount[i] = questRecord[74+i].GetUInt32(); 
     90        RewChoiceItemCount[i] = questRecord[75+i].GetUInt32(); 
    9091 
    9192    for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) 
    92         RewItemId[i] = questRecord[80+i].GetUInt32(); 
     93        RewItemId[i] = questRecord[81+i].GetUInt32(); 
    9394 
    9495    for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) 
    95         RewItemCount[i] = questRecord[84+i].GetUInt32(); 
     96        RewItemCount[i] = questRecord[85+i].GetUInt32(); 
    9697 
    9798    for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) 
    98         RewRepFaction[i] = questRecord[88+i].GetUInt32(); 
     99        RewRepFaction[i] = questRecord[89+i].GetUInt32(); 
    99100 
    100101    for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) 
    101         RewRepValue[i] = questRecord[93+i].GetInt32(); 
    102  
    103     RewOrReqMoney = questRecord[98].GetInt32(); 
    104     RewMoneyMaxLevel = questRecord[99].GetUInt32(); 
    105     RewSpell = questRecord[100].GetUInt32(); 
    106     RewSpellCast = questRecord[101].GetUInt32(); 
    107     RewMailTemplateId = questRecord[102].GetUInt32(); 
    108     RewMailDelaySecs = questRecord[103].GetUInt32(); 
    109     PointMapId = questRecord[104].GetUInt32(); 
    110     PointX = questRecord[105].GetFloat(); 
    111     PointY = questRecord[106].GetFloat(); 
    112     PointOpt = questRecord[107].GetUInt32(); 
     102        RewRepValue[i] = questRecord[94+i].GetInt32(); 
     103 
     104    RewOrReqMoney = questRecord[99].GetInt32(); 
     105    RewMoneyMaxLevel = questRecord[100].GetUInt32(); 
     106    RewSpell = questRecord[101].GetUInt32(); 
     107    RewSpellCast = questRecord[102].GetUInt32(); 
     108    RewMailTemplateId = questRecord[103].GetUInt32(); 
     109    RewMailDelaySecs = questRecord[104].GetUInt32(); 
     110    PointMapId = questRecord[105].GetUInt32(); 
     111    PointX = questRecord[106].GetFloat(); 
     112    PointY = questRecord[107].GetFloat(); 
     113    PointOpt = questRecord[108].GetUInt32(); 
    113114 
    114115    for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) 
    115         DetailsEmote[i] = questRecord[108+i].GetUInt32(); 
    116  
    117     IncompleteEmote = questRecord[112].GetUInt32(); 
    118     CompleteEmote = questRecord[113].GetUInt32(); 
     116        DetailsEmote[i] = questRecord[109+i].GetUInt32(); 
     117 
     118    IncompleteEmote = questRecord[113].GetUInt32(); 
     119    CompleteEmote = questRecord[114].GetUInt32(); 
    119120 
    120121    for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) 
    121         OfferRewardEmote[i] = questRecord[114+i].GetInt32(); 
    122  
    123     QuestStartScript = questRecord[118].GetUInt32(); 
    124     QuestCompleteScript = questRecord[119].GetUInt32(); 
     122        OfferRewardEmote[i] = questRecord[115+i].GetInt32(); 
     123 
     124    QuestStartScript = questRecord[119].GetUInt32(); 
     125    QuestCompleteScript = questRecord[120].GetUInt32(); 
    125126 
    126127    QuestFlags |= SpecialFlags << 16; 
  • trunk/src/game/QuestDef.h

    r2 r18  
    115115    // Flags used at server and sended to client 
    116116    QUEST_FLAGS_STAY_ALIVE     = 1,                         // Not used currently 
    117     QUEST_FLAGS_EVENT          = 2,                         // Not used currently 
     117    QUEST_FLAGS_PARTY_ACCEPT   = 2,                         // Not used currently. If player in party, all players that can accept this quest will receive confirmation box to accept quest CMSG_QUEST_CONFIRM_ACCEPT/SMSG_QUEST_CONFIRM_ACCEPT 
    118118    QUEST_FLAGS_EXPLORATION    = 4,                         // Not used currently 
    119119    QUEST_FLAGS_SHARABLE       = 8,                         // Can be shared: Player::CanShareQuest() 
     
    168168        // table data accessors: 
    169169        uint32 GetQuestId() const { return QuestId; } 
     170        uint32 GetQuestMethod() const { return QuestMethod; } 
    170171        int32  GetZoneOrSort() const { return ZoneOrSort; } 
    171172        int32  GetSkillOrClass() const { return SkillOrClass; } 
     
    213214        uint32 GetQuestCompleteScript() const { return QuestCompleteScript; } 
    214215        bool   IsRepeatable() const { return QuestFlags & QUEST_MANGOS_FLAGS_REPEATABLE; } 
    215         bool   IsAutoComplete() const { return Objectives.empty(); } 
     216        bool   IsAutoComplete() const { return QuestMethod ? false : true; } 
    216217        uint32 GetFlags() const { return QuestFlags; } 
    217218        bool   IsDaily() const { return QuestFlags & QUEST_FLAGS_DAILY; } 
     
    256257    protected: 
    257258        uint32 QuestId; 
     259        uint32 QuestMethod; 
    258260        int32  ZoneOrSort; 
    259261        int32  SkillOrClass; 
  • trunk/src/game/RandomMovementGenerator.cpp

    r2 r18  
    3232    float X,Y,Z,z,nx,ny,nz,wander_distance,ori,dist; 
    3333 
    34     creature.GetRespawnCoord(X, Y, Z); 
    3534    creature.GetRespawnCoord(X, Y, Z, &ori, &wander_distance); 
    3635 
     
    5150    nx = X + distanceX; 
    5251    ny = Y + distanceY; 
     52 
     53    // prevent invalid coordinates generation  
     54    MaNGOS::NormalizeMapCoord(nx); 
     55    MaNGOS::NormalizeMapCoord(ny); 
     56 
    5357    dist = distanceX*distanceX + distanceY*distanceY; 
    5458 
     
    8892    { 
    8993        i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); 
    90         creature.SetUnitMovementFlags(MOVEMENTFLAG_FLYING2); 
     94        creature.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); 
    9195    } 
    9296    //else if (is_water_ok) // Swimming mode to be done with more than this check 
     
    106110 
    107111    if (creature.canFly()) 
    108         creature.SetUnitMovementFlags(MOVEMENTFLAG_FLYING2); 
     112        creature.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); 
    109113    else 
    110114        creature.SetUnitMovementFlags(irand(0,RUNNING_CHANCE_RANDOMMV) > 0 ? MOVEMENTFLAG_WALK_MODE : MOVEMENTFLAG_NONE ); 
     
    145149        { 
    146150            if (creature.canFly()) 
    147                 creature.SetUnitMovementFlags(MOVEMENTFLAG_FLYING2); 
     151                creature.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); 
    148152            else 
    149153                creature.SetUnitMovementFlags(irand(0,RUNNING_CHANCE_RANDOMMV) > 0 ? MOVEMENTFLAG_WALK_MODE : MOVEMENTFLAG_NONE); 
  • trunk/src/game/Spell.cpp

    r15 r18  
    36823682                    return SPELL_FAILED_BAD_TARGETS; 
    36833683 
     3684                // In BattleGround players can use only flags and banners 
     3685                if( ((Player*)m_caster)->InBattleGround() && 
     3686                    !((Player*)m_caster)->isAllowUseBattleGroundObject() ) 
     3687                    return SPELL_FAILED_TRY_AGAIN; 
     3688 
    36843689                // get the lock entry 
    36853690                LockEntry const *lockInfo = NULL; 
  • trunk/src/game/SpellEffects.cpp

    r9 r18  
    5353#include "SocialMgr.h" 
    5454#include "Util.h" 
     55#include "TemporarySummon.h" 
     56 
    5557 
    5658pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= 
     
    10071009                    return; 
    10081010                } 
     1011                case 37573:                                 //Temporal Phase Modulator 
     1012                { 
     1013                    if(!unitTarget) 
     1014                        return; 
     1015 
     1016                    TemporarySummon* tempSummon = dynamic_cast<TemporarySummon*>(unitTarget); 
     1017                    if(!tempSummon) 
     1018                        return; 
     1019 
     1020                    uint32 health = tempSummon->GetHealth(); 
     1021                    const uint32 entry_list[6] = {21821, 21820, 21817}; 
     1022 
     1023                    float x = tempSummon->GetPositionX(); 
     1024                    float y = tempSummon->GetPositionY(); 
     1025                    float z = tempSummon->GetPositionZ(); 
     1026                    float o = tempSummon->GetOrientation(); 
     1027 
     1028                    tempSummon->UnSummon(); 
     1029 
     1030                    Creature* pCreature = m_caster->SummonCreature(entry_list[urand(0, 2)], x, y, z, o,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,180000); 
     1031                    if (!pCreature) 
     1032                        return; 
     1033 
     1034                    pCreature->SetHealth(health); 
     1035 
     1036                    if(pCreature->AI()) 
     1037                        pCreature->AI()->AttackStart(m_caster); 
     1038 
     1039                    return; 
     1040                } 
     1041                case 34665:                                 //Administer Antidote 
     1042                { 
     1043                    if(!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER ) 
     1044                        return; 
     1045 
     1046                    if(!unitTarget) 
     1047                        return; 
     1048 
     1049                    TemporarySummon* tempSummon = dynamic_cast<TemporarySummon*>(unitTarget); 
     1050                    if(!tempSummon) 
     1051                        return; 
     1052 
     1053                    uint32 health = tempSummon->GetHealth(); 
     1054 
     1055                    float x = tempSummon->GetPositionX(); 
     1056                    float y = tempSummon->GetPositionY(); 
     1057                    float z = tempSummon->GetPositionZ(); 
     1058                    float o = tempSummon->GetOrientation(); 
     1059                    tempSummon->UnSummon(); 
     1060 
     1061                    Creature* pCreature = m_caster->SummonCreature(16992, x, y, z, o,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,180000); 
     1062                    if (!pCreature) 
     1063                        return; 
     1064 
     1065                    pCreature->SetHealth(health); 
     1066                    ((Player*)m_caster)->KilledMonster(16992,pCreature->GetGUID()); 
     1067 
     1068                    if (pCreature->AI()) 
     1069                        pCreature->AI()->AttackStart(m_caster); 
     1070 
     1071                    return; 
     1072                } 
     1073                case 44997:                                 // Converting Sentry 
     1074                { 
     1075                    //Converted Sentry Credit 
     1076                    m_caster->CastSpell(m_caster, 45009, true); 
     1077                    return; 
     1078                }                 
    10091079                case 45030:                                 // Impale Emissary 
    10101080                { 
    10111081                    // Emissary of Hate Credit 
    1012                     m_caster->CastSpell(m_caster,45088,true); 
     1082                    m_caster->CastSpell(m_caster, 45088, true); 
    10131083                    return; 
    10141084                } 
     
    11001170                            ((Player*)m_caster)->GetSession()->SendPacket(&data); 
    11011171                        } 
     1172                    } 
     1173                    return; 
     1174                } 
     1175                case 32826: 
     1176                { 
     1177                    if ( unitTarget && unitTarget->GetTypeId() == TYPEID_UNIT ) 
     1178                    { 
     1179                        //Polymorph Cast Visual Rank 1 
     1180                        const uint32 spell_list[6] = {32813, 32816, 32817, 32818, 32819, 32820}; 
     1181                        unitTarget->CastSpell( unitTarget, spell_list[urand(0, 5)], true);  
    11021182                    } 
    11031183                    return; 
     
    27612841            goInfo->type == GAMEOBJECT_TYPE_GOOBER && goInfo->goober.losOK ) 
    27622842        { 
    2763             if(BattleGround *bg = player->GetBattleGround())// in battleground 
    2764             { 
    2765                 if( !player->IsMounted() &&                 // not mounted 
    2766                     !player->HasStealthAura() &&            // not stealthed 
    2767                     !player->HasInvisibilityAura() &&       // not invisible 
    2768                     player->isAlive() )                     // live player 
    2769                 { 
    2770                     // check if it's correct bg 
    2771                     if(bg && bg->GetTypeID() == BATTLEGROUND_AB) 
    2772                         bg->EventPlayerClickedOnFlag(player, gameObjTarget); 
    2773  
    2774                     return; 
    2775                 } 
     2843            //isAllowUseBattleGroundObject() already called in CanCast() 
     2844            // in battleground check 
     2845            if(BattleGround *bg = player->GetBattleGround()) 
     2846            { 
     2847                // check if it's correct bg 
     2848                if(bg && bg->GetTypeID() == BATTLEGROUND_AB) 
     2849                    bg->EventPlayerClickedOnFlag(player, gameObjTarget); 
     2850                return; 
    27762851            } 
    27772852        } 
    27782853        else if (goInfo->type == GAMEOBJECT_TYPE_FLAGSTAND) 
    27792854        { 
     2855            //isAllowUseBattleGroundObject() already called in CanCast() 
     2856            // in battleground check 
    27802857            if(BattleGround *bg = player->GetBattleGround()) 
     2858            { 
    27812859                if(bg->GetTypeID() == BATTLEGROUND_EY) 
    27822860                    bg->EventPlayerClickedOnFlag(player, gameObjTarget); 
    2783             return; 
     2861                return; 
     2862            } 
    27842863        } 
    27852864        lockId = gameObjTarget->GetLockId(); 
     
    47524831            break; 
    47534832        } 
     4833        //5,000 Gold 
     4834        case 46642: 
     4835        { 
     4836            if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) 
     4837                return; 
     4838 
     4839            ((Player*)unitTarget)->ModifyMoney(50000000); 
     4840 
     4841            break; 
     4842        } 
    47544843    } 
    47554844 
  • trunk/src/game/TargetedMovementGenerator.cpp

    r2 r18  
    8686    i_destinationHolder.SetDestination(traveller, x, y, z); 
    8787    owner.addUnitState(UNIT_STAT_CHASE); 
     88    if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly()) 
     89        owner.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); 
    8890} 
    8991 
     
    9597        return; 
    9698    owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); 
     99 
     100    if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly()) 
     101        owner.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); 
     102     
    97103    _setTargetLocation(owner); 
    98104} 
     
    144150    { 
    145151        owner.addUnitState(UNIT_STAT_CHASE); 
     152        if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly()) 
     153            owner.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); 
     154 
    146155        i_destinationHolder.StartTravel(traveller); 
    147156        return true; 
  • trunk/src/game/WaypointMovementGenerator.cpp

    r6 r18  
    113113            creature.addUnitState(UNIT_STAT_ROAMING); 
    114114            if (creature.canFly()) 
    115                 creature.SetUnitMovementFlags(MOVEMENTFLAG_FLYING2); 
     115                creature.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); 
    116116            const WaypointNode &node = i_path->at(i_currentNode); 
    117117            i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z); 
     
    177177            creature.addUnitState(UNIT_STAT_ROAMING); 
    178178            if (creature.canFly()) 
    179                 creature.SetUnitMovementFlags(MOVEMENTFLAG_FLYING2); 
     179                creature.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); 
    180180            const WaypointNode &node = i_path->at(i_currentNode); 
    181181            i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z); 
  • trunk/src/trinitycore/TrinityCore.rc

    r6 r18  
    5353 
    5454VS_VERSION_INFO VERSIONINFO 
    55  FILEVERSION 0,2,6721,676 
    56  PRODUCTVERSION 0,2,6721,676 
     55 FILEVERSION 0,3,6731,680 
     56 PRODUCTVERSION 0,3,6731,680 
    5757 FILEFLAGSMASK 0x17L 
    5858#ifdef _DEBUG 
     
    7070        BEGIN 
    7171            VALUE "FileDescription", "TrinityCore" 
    72             VALUE "FileVersion", "0, 2, 6721, 676" 
     72            VALUE "FileVersion", "0, 3, 6731, 680" 
    7373            VALUE "InternalName", "TrinityCore" 
    7474            VALUE "LegalCopyright", "Copyright (C) 2008" 
    7575            VALUE "OriginalFilename", "TrinityCore.exe" 
    7676            VALUE "ProductName", "TrinityCore" 
    77             VALUE "ProductVersion", "0, 2, 6721, 676" 
     77            VALUE "ProductVersion", "0, 3, 6731, 680" 
    7878        END 
    7979    END 
  • trunk/src/trinityrealm/TrinityRealm.rc

    r6 r18  
    5353 
    5454VS_VERSION_INFO VERSIONINFO 
    55  FILEVERSION 0,2,6721,676 
    56  PRODUCTVERSION 0,2,6721,676 
     55 FILEVERSION 0,3,6731,680 
     56 PRODUCTVERSION 0,3,6731,680 
    5757 FILEFLAGSMASK 0x17L 
    5858#ifdef _DEBUG 
     
    7070        BEGIN 
    7171            VALUE "FileDescription", "TrinityRealm" 
    72             VALUE "FileVersion", "0, 2, 6721, 676" 
     72            VALUE "FileVersion", "0, 3, 6731, 680" 
    7373            VALUE "InternalName", "TrinityRealm" 
    7474            VALUE "LegalCopyright", "Copyright (C) 2008" 
    7575            VALUE "OriginalFilename", "TrinityRealm.exe" 
    7676            VALUE "ProductName", "TrinityRealm" 
    77             VALUE "ProductVersion", "0, 2, 6721, 676" 
     77            VALUE "ProductVersion", "0, 3, 6731, 680" 
    7878        END 
    7979    END 
  • trunk/win/VC90/ACE_vc9.vcproj

    r11 r18  
    5050                        <Tool 
    5151                                Name="VCCLCompilerTool" 
    52                                 AdditionalOptions="/MP /wd 4748" 
     52                                AdditionalOptions="/MP /wd 4748 /wd 4244" 
    5353                                Optimization="0" 
    5454                                AdditionalIncludeDirectories="..\..\dep\ACE_wrappers" 
     
    139139                        <Tool 
    140140                                Name="VCCLCompilerTool" 
    141                                 AdditionalOptions="/MP /wd 4748" 
     141                                AdditionalOptions="/MP /wd 4748 /wd 4244" 
    142142                                Optimization="0" 
    143143                                AdditionalIncludeDirectories="..\..\dep\ACE_wrappers" 
     
    229229                        <Tool 
    230230                                Name="VCCLCompilerTool" 
    231                                 AdditionalOptions="/MP /wd 4748" 
     231                                AdditionalOptions="/MP /wd 4748 /wd 4244" 
    232232                                Optimization="2" 
    233233                                AdditionalIncludeDirectories="..\..\dep\ACE_wrappers" 
     
    317317                        <Tool 
    318318                                Name="VCCLCompilerTool" 
    319                                 AdditionalOptions="/MP /wd 4748" 
     319                                AdditionalOptions="/MP /wd 4748 /wd 4244" 
    320320                                Optimization="2" 
    321321                                AdditionalIncludeDirectories="..\..\dep\ACE_wrappers" 
     
    28542854                        </File> 
    28552855                        <File 
     2856                                RelativePath="..\..\dep\ACE_wrappers\ace\os_include\os_errno.h" 
     2857                                > 
     2858                        </File> 
     2859                        <File 
    28562860                                RelativePath="..\..\dep\ACE_wrappers\ace\OS_Errno.h" 
    28572861                                > 
    28582862                        </File> 
    28592863                        <File 
    2860                                 RelativePath="..\..\dep\ACE_wrappers\ace\os_include\os_errno.h" 
    2861                                 > 
    2862                         </File> 
    2863                         <File 
    28642864                                RelativePath="..\..\dep\ACE_wrappers\ace\os_include\os_fcntl.h" 
    28652865                                > 
     
    32383238                        </File> 
    32393239                        <File 
     3240                                RelativePath="..\..\dep\ACE_wrappers\ace\os_include\os_string.h" 
     3241                                > 
     3242                        </File> 
     3243                        <File 
    32403244                                RelativePath="..\..\dep\ACE_wrappers\ace\OS_String.h" 
    32413245                                > 
    32423246                        </File> 
    32433247                        <File 
    3244                                 RelativePath="..\..\dep\ACE_wrappers\ace\os_include\os_string.h" 
    3245                                 > 
    3246                         </File> 
    3247                         <File 
    32483248                                RelativePath="..\..\dep\ACE_wrappers\ace\os_include\os_strings.h" 
    32493249                                > 
     
    32863286                        </File> 
    32873287                        <File 
     3288                                RelativePath="..\..\dep\ACE_wrappers\ace\os_include\os_time.h" 
     3289                                > 
     3290                        </File> 
     3291                        <File 
    32883292                                RelativePath="..\..\dep\ACE_wrappers\ace\os_include\sys\os_time.h" 
    3289                                 > 
    3290                         </File> 
    3291                         <File 
    3292                                 RelativePath="..\..\dep\ACE_wrappers\ace\os_include\os_time.h" 
    32933293                                > 
    32943294                        </File>