23.04.2012, 19:47 | #1 |
Гость
Сообщений: n/a
|
[MoD] XP Trader
Решил попробовать написать продавца опыта на основе телегая. На ласт реве мангоса комплится без ошибок. В игре ничего не проверял. Цены брались примерные.
Инструкция по установке: 1. Создать файл npc_xp.cpp здесь: папка_с_исходниками/mangos/src/bindings/scriptdev2/scripts/custom. Не забудьте перед этим положить папку scriptdev2 в папку bindings. 2. Скопировать весь этот большой код в наш файл. 3. Зайти в папка_с_исходниками/mangos/src/bindings/scriptdev2/system, найти там ScriptLoader.cpp, открыть его, найти Код:
// custom Код:
extern void AddSC_npc_xp(); Код:
AddSC_npc_xp(); тестовым редактором, находим Код:
<Filter Name="custom" > </Filter> Код:
<File RelativePath="..\scripts\custom\npc_xp.cpp" > Вот npc_xp.cpp: Код:
/* Copyright (C) 2006 - 2011 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* ScriptData SDName: npc_xp SD%Complete: 100% SDComment: need test SDCategory: custom EndScriptData */ #include "precompiled.h" long long int money; int costo; bool GossipHello_npc_xp(Player *player, Creature *_Creature) { player->ADD_GOSSIP_ITEM( 5, "1000 XP. 2 Gold" , GOSSIP_SENDER_MAIN, 99995); player->ADD_GOSSIP_ITEM( 5, "5000 XP. 10 Gold" , GOSSIP_SENDER_MAIN, 99996); player->ADD_GOSSIP_ITEM( 5, "10000 XP. 20 Gold" , GOSSIP_SENDER_MAIN, 99997); player->ADD_GOSSIP_ITEM( 5, "50000 XP. 100 Gold" , GOSSIP_SENDER_MAIN, 99998); player->ADD_GOSSIP_ITEM( 5, "100000 XP. 200 Gold" , GOSSIP_SENDER_MAIN, 99999); player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetObjectGuid()); return true; } void SendDefaultMenu_mob_teleguy(Player *player, Creature *_Creature, uint32 action ) { if(player->getLevel() >= 80 ) { player->CLOSE_GOSSIP_MENU(); _Creature->MonsterSay("You have reached max level!", LANG_UNIVERSAL); return; } money = player-> GetMoney(); costo = 20000; if (money < costo ) { player->CLOSE_GOSSIP_MENU(); _Creature->MonsterSay("You haven't enough money", LANG_UNIVERSAL); return; } switch(action) { case 99995: // 1000xp player->CLOSE_GOSSIP_MENU(); player->GiveXP(1000, NULL); player->ModifyMoney(-1*costo); break; case 99996: // 5000xp player->CLOSE_GOSSIP_MENU(); player->GiveXP(5000, NULL); player->ModifyMoney(-5*costo); break; case 99997: // 10000xp player->CLOSE_GOSSIP_MENU(); player->GiveXP(10000, NULL); player->ModifyMoney(-10*costo); break; case 99998: // 50000xp player->CLOSE_GOSSIP_MENU(); player->GiveXP(50000, NULL); player->ModifyMoney(-50*costo); break; case 99999: // 100000xp player->CLOSE_GOSSIP_MENU(); player->GiveXP(100000, NULL); player->ModifyMoney(-100*costo); break; } } bool GossipSelect_npc_xp(Player *player, Creature *_Creature, uint32 sender, uint32 action) { if (sender == GOSSIP_SENDER_MAIN) { player->PlayerTalkClass->ClearMenus(); SendDefaultMenu_mob_teleguy(player, _Creature, action); } return true; } void AddSC_npc_xp() { Script *newscript; newscript = new Script; newscript->Name = "npc_xp"; newscript->pGossipHello = &GossipHello_npc_xp; newscript->pGossipSelect = &GossipSelect_npc_xp; newscript->RegisterSelf(); } Код:
DELETE FROM `creature_template` WHERE `entry`=99002; INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid_1`, `modelid_2`, `modelid_3`, `modelid_4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `minhealth`, `maxhealth`, `PowerType`, `minmana`, `maxmana`, `armor`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `vehicle_id`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `unk16`, `unk17`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES (99002, 0, 0, 0, 0, 0, 18, 0, 18, 0, 'Archibald', 'XP Trader', NULL, 0, 70, 70, 6700, 24000, 0, 5598, 5875, 4049, 35, 35, 1, 1.48, 1.14286, 1, 0, 98, 147, 0, 37, 1.4, 1400, 1400, 2, 0, 0, 0, 0, 0, 0, 0, 78, 118, 30, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 'npc_xp'); Последний раз редактировалось staf0rd; 03.05.2012 в 17:22. |
Опции темы | Поиск в этой теме |
Опции просмотра | |
|
|