吾爱尚玩资源基地
标题:
修改玩家姓名的脚本代码
[打印本页]
作者:
admin
时间:
2016-4-18 22:48
标题:
修改玩家姓名的脚本代码
修改玩家姓名的脚本代码:
diff -r a09fe1125922 src/bindings/scripts/scripts/examples/example_gossip_codebox.cpp
--- a/src/bindings/scripts/scripts/examples/example_gossip_codebox.cpp Wed Sep 30 04:26:35 2009 -0700
+++ b/src/bindings/scripts/scripts/examples/example_gossip_codebox.cpp Wed Sep 30 20:11:23 2009 +0200
@@ -31,7 +31,8 @@
SAY_NOT_INTERESTED = -1999922,
SAY_WRONG = -1999923,
- SAY_CORRECT = -1999924
+ SAY_CORRECT = -1999924,
+ SAY_BYE_BYE = -1999915
};
#define GOSSIP_ITEM_1 "A quiz: what's your name?"
@@ -97,3 +98,85 @@
newscript->pGossipSelectWithCode = &GossipSelectWithCode_example_gossip_codebox;
newscript->RegisterSelf();
}
+
+
+
+/* Begin custom code for the NPC Renamer */
+/*****************************************/
+/* ScriptData
+Author: 1RR3QU13T0 - ricci77
+SDName: npc_rename_script
+SD%Complete: 100
+SDComment: Npc that can change pg name after a login
+SDCategory: Script Examples
+EndScriptData */
+
+//This function is called when the player opens the gossip menubool
+bool GossipHello_custom_rename_codebox(Player *player, Creature *_Creature)
+{
+ player->ADD_GOSSIP_ITEM_EXTENDED(0, "Rename? Put yes or no in the box. If you choose yes, you need 500 gold.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1, "", 0, true);
+ player->ADD_GOSSIP_ITEM(0, "You're not interested.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
+ player->PlayerTalkClass->SendGossipMenu(907,_Creature->GetGUID());
+ return true;
+}
+
+//This function is called when the player clicks an option on the gossip menubool
+bool GossipSelect_custom_rename_codebox(Player *player, Creature *_Creature, uint32 sender, uint32 action )
+{
+ if(action == GOSSIP_ACTION_INFO_DEF+2)
+ {
+ DoScriptText(SAY_NOT_INTERESTED, _Creature);
+ player->CLOSE_GOSSIP_MENU();
+ }
+ return true;
+}
+
+bool GossipSelectWithCode_custom_rename_codebox( Player *player, Creature *_Creature, uint32 sender, uint32 action, const char* sCode )
+{
+ // "cost" is the amount of gold needed for renaming - set to 500g
+ uint32 cost = 5000000;
+ if(sender == GOSSIP_SENDER_MAIN)
+ {
+ if(action == GOSSIP_ACTION_INFO_DEF+1)
+ {
+ if(std::strcmp(sCode, "yes") ==0)
+ {
+ if (player->GetMoney() < cost)
+ {
+ player->SendBuyError( BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
+ player->CLOSE_GOSSIP_MENU();
+ }
+ else
+ {
+ DoScriptText(SAY_BYE_BYE, _Creature);
+ player->SetAtLoginFlag(AT_LOGIN_RENAME);
+ player->CLOSE_GOSSIP_MENU();
+ player->SetMoney( player->GetMoney() - cost );
+ }
+ }
+ else if (std::strcmp(sCode, "no") ==0)
+ {
+ DoScriptText(SAY_BYE_BYE, _Creature);
+ player->CLOSE_GOSSIP_MENU();
+ }
+ else
+ {
+ player->CLOSE_GOSSIP_MENU();
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+void AddSC_custom_rename_codebox()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="custom_rename_codebox";
+ newscript->pGossipHello = &GossipHello_custom_rename_codebox;
+ newscript->pGossipSelect = &GossipSelect_custom_rename_codebox;
+ newscript->pGossipSelectWithCode = &GossipSelectWithCode_custom_rename_codebox;
+ newscript->RegisterSelf();
+}
diff -r a09fe1125922 src/bindings/scripts/system/ScriptLoader.cpp
--- a/src/bindings/scripts/system/ScriptLoader.cpp Wed Sep 30 04:26:35 2009 -0700
+++ b/src/bindings/scripts/system/ScriptLoader.cpp Wed Sep 30 20:11:23 2009 +0200
@@ -11,6 +11,7 @@
extern void AddSC_example_escort();
extern void AddSC_example_gossip_codebox();
extern void AddSC_example_misc();
+extern void AddSC_custom_rename_codebox();
//world
extern void AddSC_areatrigger_scripts();
@@ -425,6 +426,7 @@
AddSC_example_escort();
AddSC_example_gossip_codebox();
AddSC_example_misc();
+ AddSC_custom_rename_codebox();
//world
AddSC_areatrigger_scripts();
作者:
admin
时间:
2016-4-18 22:48
SQL的部分代码
/*
SQLyog Community Edition- MySQL GUI
MySQL - 5.1.33-community
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
insert into `creature_template` (`entry`, `heroic_entry`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `minlevel`, `maxlevel`, `minhealth`, `maxhealth`, `minmana`, `maxmana`, `armor`, `faction_A`, `faction_H`, `npcflag`, `speed`, `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`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `unk16`, `unk17`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) values('99999','0','0','0','4602','4602','4602','4601','NPC Renamer',NULL,'Directions','75','75','15952','15952','0','0','8219','1797','1797','268435457','1.2','1','0','342','485','0','392','1','2000','0','1','36864','0','0','0','0','0','0','295','438','68','7','0','0','3296','0','0','0','0','0','0','0','40505','8599','0','0','0','0','0','0','0','0','0','0','','0','1','1.5','1','0','0','0','0','0','0','1','295','0','0','custom_rename_codebox');
欢迎光临 吾爱尚玩资源基地 (http://bbs.523play.com/)
Powered by Discuz! X3.4