Likes: 0
Results 1 to 2 of 2
-
08-08-14, 10:43 PM #1
Honorable Kills Shop (script + NPC)
Register to remove this adHey guys. I just want to start with a little heads-up as a result from some of my other releases.. I am not a professional C++ coder, so I'm sure it can be done in a better way, but as far as it works, I'm happy about it and I'm just doing this to share what I can with you guys.
So, what does the script do? It checks if the player who's using it has (IN MY CASE - EDITABLE) 5,000 kills or more (also, editable!!), and if so - he can view the shop which you need to add ingame via .npc add item command, like any other vendor.
Code:INSERT INTO `creature_template` (`entry`,`difficulty_entry_1`,`difficulty_entry_2`,`difficulty_entry_3`,`KillCredit1`,`KillCredit2`,`modelid1`,`modelid2`,`modelid3`,`modelid4`,`name`,`subname`,`IconName`,`gossip_menu_id`,`minlevel`,`maxlevel`,`exp`,`faction`,`npcflag`,`speed_walk`,`speed_run`,`scale`,`rank`,`mindmg`,`maxdmg`,`dmgschool`,`attackpower`,`dmg_multiplier`,`baseattacktime`,`rangeattacktime`,`unit_class`,`unit_flags`,`unit_flags2`,`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`,`HoverHeight`,`Health_mod`,`Mana_mod`,`Armor_mod`,`RacialLeader`,`questItem1`,`questItem2`,`questItem3`,`questItem4`,`questItem5`,`questItem6`,`movementId`,`RegenHealth`,`mechanic_immune_mask`,`flags_extra`,`ScriptName`,`VerifiedBuild`) VALUES (151516, 0, 0, 0, 0, 0, 23445, 0, 0, 0, 'Name', 'Subname', '', 0, 80, 80, 0, 35, 129, 1, 1, 1, 0, 0, 0, 0, 0, 0, 2000, 2000, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 'hk_kills_shop', 1);
The script:
Code:class honorable_kills_shop : public CreatureScript { public: honorable_kills_shop() : CreatureScript("hk_kills_shop") { } bool OnGossipHello(Player* player, Creature* creature) { player->ADD_GOSSIP_ITEM(4, "[5,000 Lifetime Kills are required in order to view my goods. Make sure you have it, or you won't be able to view nor purchase anything.]", GOSSIP_SENDER_MAIN, 1001); //first menu option - a note for what this creature is player->ADD_GOSSIP_ITEM(4, "[5k kills] Show me what you got!", GOSSIP_SENDER_MAIN, 1002); //second option, click to send to the vendor (if he has 5k kills) player->SEND_GOSSIP_MENU(1, creature->GetGUID()); // This sends the menu to the player return true; } bool OnGossipSelect(Player* player, Creature* pCreature, uint32 /*uiSender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); switch (action) { ///////////START ACTIONS////////////////// case 1001: player->CLOSE_GOSSIP_MENU(); break; case 1002: if (player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KIL LS) >= 5000) { player->GetSession()->SendListInventory(pCreature->GetGUID()), //send to the vendor himself. add items via .npc add item command pCreature->MonsterWhisper("You have 5,000 kills or more, therefore you can view my goods.", player, true); //if the player has 5k kills, send this message when } else { player->MonsterWhisper("You do not have 5,000 kills or more, therefore I cannot allow you to check my store. Sorry.", player, true), player->CLOSE_GOSSIP_MENU(); //send this "error" message and close everything } break; } return true; } }; void AddSC_Honorable_Kills_Shop() { new honorable_kills_shop(); }
The following code also includes if you want the script the script to an exact number of kills, more kills than (..) or less kills than (..).
To make it exact, edit the ">=" to "==".
To make it more than (..), leave it as it is.
To make it less than (..), edit the ">=" to "<=".
Code:if (player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KIL LS) >= 5000)
Update - sorry for the huge delay, but instead of several screenshots I made a video.
Credits : Zeraax
› See More: Honorable Kills Shop (script + NPC)
-
13-10-14, 05:23 PM #2Dr.CoreGuest
Register to remove this adRespect =)
But here is a Fixxed Version =)
PHP Code:class honorable_kills_shop : public CreatureScript
{
public:
honorable_kills_shop() : CreatureScript("hk_kills_shop") { }
bool OnGossipHello(Player* player, Creature* creature)
{
player->ADD_GOSSIP_ITEM(4, "[500 Lifetime Kills are required in order to view my goods. Make sure you have it, or you won't be able to view nor purchase anything.]", GOSSIP_SENDER_MAIN, 1001); //first menu option - a note for what this creature is
player->ADD_GOSSIP_ITEM(4, "[500 Kills] Show me what you got!", GOSSIP_SENDER_MAIN, 1002); //second option, click to send to the vendor (if he has 500 Kills)
player->SEND_GOSSIP_MENU(1, creature->GetGUID()); // This sends the menu to the player
return true;
}
bool OnGossipSelect(Player* player, Creature* pCreature, uint32 /*uiSender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
switch (action)
{
///////////START ACTIONS//////////////////
case 1001:
player->CLOSE_GOSSIP_MENU();
break;
case 1002:
if (player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) >= 500)
{
player->GetSession()->SendListInventory(pCreature->GetGUID()), //send to the vendor himself. add items via .npc add item command
pCreature->Whisper("You have 500 kills or more, therefore you can view my goods.", LANG_UNIVERSAL, player, true); //if the player has 500 Kills, send this message when
}
else
{
pCreature->Whisper("You do not have 500 kills or more, therefore I cannot allow you to check my store. Sorry.", LANG_UNIVERSAL, player, true), player->CLOSE_GOSSIP_MENU(); //send this "error" message and close everything
}
break;
}
return true;
}
};
void AddSC_Honorable_Kills_Shop()
{
new honorable_kills_shop();
}