Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.87 KB | None | 0 0
  1. //--------------------------------------------------------------------------------------
  2. //------------------------ Gargajo - CREATURE_GOBBER ----------------------------------------------
  3.  
  4. #define SAY_GARGAJO_F1 """\xc2\xa1""Yo machacarte!"
  5. #define SAY_GARGAJO_F2 """\xc2\xa1""Tu no gustarme!"
  6. #define SAY_GARGAJO_F3 """\xc2\xa1""Romper! ""\xc2\xa1""Machacar!"
  7. #define SAY_GARGAJO_F4 """\xc2\xa1""Te la has ganado!"
  8. #define SAY_GARGAJO_INTOV1 """\xc2\xa1""Genial!"
  9. #define SAY_GARGAJO_INTOV2 "Yo tambi""\xC3\xA9""n quiero conducir alguna vez..."
  10.  
  11. #define SAY_AS_F1 """\xc2\xa1""Romperle las piernas!"
  12. #define SAY_AS_F2 """\xc2\xa1""D""\xC3\xB3""nde est""\xC3\xA1"" mi dinero!"
  13. #define SAY_AS_F3 """\xc2\xa1""Te voy a dar un le""\xc3\xb1""azo que te va a doler a ti y al de all""\xC3\xA1""!"
  14. #define SAY_AS_F4 """\xc2\xa1""Pero t""\xC3\xBA"" quien te crees que somos!"
  15. #define SAY_AS_INTOV1 """\xc2\xa1""Menudo buga m""\xC3\xA1""s guapo!"
  16. #define SAY_AS_INTOV2 """\xc2\xa1""Dale! ""\xc2\xa1""Dale!"
  17. #define SAY_AS_INTOV3 """\xc2\xa1""Vamos a llevarnos a todo el mundo por delante!"
  18.  
  19. #define SAY_IZZY_F1 "Te has metido en una buena, cari""\xc3\xb1""o."
  20. #define SAY_IZZY_F2 """\xc2\xa1""Agarrarlo que yo le atizo!"
  21. #define SAY_IZZY_F3 """\xc2\xa1""Oghhh! Pero mira que eres feo."
  22. #define SAY_IZZY_F4 "Pobre. Te librar""\xC3\xA9"" de tu sufrimiento... o no..."
  23. #define SAY_IZZY_INTOV1 """\xc2\xa1""Soy toda tuya!"
  24. #define SAY_IZZY_INTOV2 """\xc2\xa1""Vamos a atropellar cabezas!"
  25.  
  26. class npc_trio_calatraba : public CreatureScript
  27. {
  28. public:
  29. npc_trio_calatraba() : CreatureScript("npc_trio_calatraba") { }
  30.  
  31. struct npc_trio_calatrabaAI : public ScriptedAI
  32. {
  33. npc_trio_calatrabaAI(Creature* creature) : ScriptedAI(creature) {}
  34.  
  35. bool castOrNor;
  36. bool restored;
  37. bool AggrOrNot;
  38. uint32 timermo;
  39. uint32 pasivePHReg;
  40. uint32 Entry;
  41. uint32 Ontimex;
  42.  
  43. void Reset()
  44. {
  45.  
  46. timermo = urand(3000, 5000);
  47. castOrNor = true;
  48. pasivePHReg = 3000;
  49. Entry = me->GetEntry();
  50.  
  51. Unit* owner = me->GetOwner();
  52. if (owner)
  53. me->InitCharmInfo();
  54.  
  55. if(Ontimex != 3)
  56. OneTime();
  57. }
  58. void OneTime()
  59. {
  60. restored = false;
  61. AggrOrNot = false;
  62. Ontimex = 3;
  63. }
  64.  
  65. void MoveInLineOfSight(Unit* who)
  66. {
  67. Unit* owner = me->GetOwner();
  68. if (owner)
  69. return;
  70.  
  71. if (who->GetTypeId() != TYPEID_PLAYER && who->GetEntry() != CREATURE_VEHICLE_BOLIDO)
  72. return;
  73.  
  74.  
  75. if(who->GetEntry() == CREATURE_VEHICLE_BOLIDO)
  76. {
  77. if(Vehicle* vh = who->GetVehicleKit())
  78. if(Unit* Sdo = vh->GetPassenger(0))
  79. if(Sdo->GetTypeId() == TYPEID_PLAYER)
  80. {
  81. who = Sdo;
  82. }
  83. else return;
  84. else return;
  85. }
  86.  
  87. castOrNor = true;
  88.  
  89. //QUEST_VOY_EN_UN_COCHE
  90. if(who->GetTypeId() == TYPEID_PLAYER && who->IsInWorld())
  91. {
  92. if(me->GetDistance2d(who) < 11.0f && ((Player*)who)->GetQuestStatus(QUEST_VOY_EN_UN_COCHE) == QUEST_STATUS_INCOMPLETE)
  93. {
  94. Unit* chr = who->GetCharm();
  95. std::list<Creature*> StdList;
  96. me->GetCreatureListWithEntryInGrid(StdList, Entry, 40.0f);
  97. for (std::list<Creature*>::const_iterator itr = StdList.begin(); itr != StdList.end(); ++itr)
  98. {
  99. if(StdList.empty())
  100. castOrNor = true;
  101. else
  102. {
  103.  
  104. Unit* crOwner = (*itr)->GetOwner();
  105. if(!crOwner)
  106. continue;
  107. else if (crOwner = who)
  108. castOrNor = false;
  109. }
  110. }
  111.  
  112. ((Player*)who)->KilledMonsterCredit(Entry, 0);
  113.  
  114. if(castOrNor)
  115. {
  116. if(Entry == CREATURE_GOBBER) //Gordi
  117. who->CastSpell(who,GOBBER_INVO,true);
  118. if(Entry == CREATURE_ACE) //As
  119. who->CastSpell(who,ACE_INVO,true);
  120. if(Entry == CREATURE_IZZY) //Izzy
  121. who->CastSpell(who,IZZY_INVO,true);
  122.  
  123. me->DespawnOrUnsummon();
  124. me->SetRespawnDelay(7);
  125. me->SetRespawnTime(6);
  126. // me->Respawn();
  127. }
  128. else return;
  129. }
  130. }}
  131.  
  132. void EnterCombat(Unit* /*who*/)
  133. {
  134. if(me->GetReactState() == REACT_PASSIVE || me->GetReactState() == REACT_PASSIVE)
  135. return;
  136.  
  137. if(Entry == CREATURE_GOBBER) //Gordi
  138. {
  139. switch (rand() % 7)
  140. {
  141. case 0: me->MonsterSay(SAY_GARGAJO_F1, LANG_UNIVERSAL, 0); break;
  142. case 1: me->MonsterSay(SAY_GARGAJO_F2, LANG_UNIVERSAL, 0); break;
  143. case 2: me->MonsterSay(SAY_GARGAJO_F3, LANG_UNIVERSAL, 0); break;
  144. case 3: me->MonsterSay(SAY_GARGAJO_F4, LANG_UNIVERSAL, 0); break;
  145. case 4: case 5: case 6: break;
  146. }
  147. }
  148. if(Entry == CREATURE_ACE) //As
  149. {
  150. switch (rand() % 7)
  151. {
  152. case 0: me->MonsterSay(SAY_AS_F1, LANG_UNIVERSAL, 0); break;
  153. case 1: me->MonsterSay(SAY_AS_F2, LANG_UNIVERSAL, 0); break;
  154. case 2: me->MonsterSay(SAY_AS_F3, LANG_UNIVERSAL, 0); break;
  155. case 3: me->MonsterSay(SAY_AS_F4, LANG_UNIVERSAL, 0); break;
  156. case 4: case 5: case 6: break;
  157. }
  158. }
  159. if(Entry == CREATURE_IZZY) //Izzy
  160. {
  161. switch (rand() % 7)
  162. {
  163. case 0: me->MonsterSay(SAY_IZZY_F1, LANG_UNIVERSAL, 0); break;
  164. case 1: me->MonsterSay(SAY_IZZY_F2, LANG_UNIVERSAL, 0); break;
  165. case 2: me->MonsterSay(SAY_IZZY_F3, LANG_UNIVERSAL, 0); break;
  166. case 3: me->MonsterSay(SAY_IZZY_F4, LANG_UNIVERSAL, 0); break;
  167. case 4: case 5: case 6: break;
  168. }
  169. }
  170. }
  171.  
  172. void UpdateAI(uint32 diff)
  173. {
  174. Unit* owner = me->GetOwner();
  175. if (!owner)
  176. return;
  177.  
  178. if(restored && me->GetDistance2d(owner) < 6.0f)
  179. AggrOrNot = false;
  180.  
  181. if(me->GetDistance2d(owner) > 15.0f && AggrOrNot && !UpdateVictim())
  182. {
  183. if(me->GetCharmInfo())
  184. {
  185. me->GetCharmInfo()->RestoreState();
  186.  
  187. AggrOrNot = false;
  188. }
  189. }
  190.  
  191. if (UpdateVictim())
  192. {
  193. if(me->GetDistance2d(owner) > 35.0f)
  194. {
  195. me->GetVictim()->DeleteThreatList();
  196. me->GetVictim()->CombatStop(true);
  197.  
  198. me->GetCharmInfo()->RestoreState();
  199. me->SetReactState(REACT_PASSIVE);
  200. restored = true;
  201. }
  202.  
  203. DoMeleeAttackIfReady();
  204. }
  205.  
  206.  
  207. if (owner->GetTypeId() != TYPEID_PLAYER)
  208. return;
  209.  
  210. if(!AggrOrNot && !owner->GetVehicleBase() && !me->GetVehicleBase())
  211. {
  212. me->SetReactState(REACT_AGGRESSIVE);
  213. AggrOrNot = true;
  214. }
  215.  
  216. //IsOnVehicle
  217. if(owner->GetVehicleBase() && owner->GetVehicleBase()->GetEntry() == CREATURE_VEHICLE_BOLIDO && !me->GetVehicleBase())
  218. {
  219.  
  220. me->SetReactState(REACT_PASSIVE);
  221. AggrOrNot = false;
  222.  
  223. if(Entry == CREATURE_GOBBER) //Gordi
  224. {
  225. switch (rand() % 5){
  226. case 0: me->MonsterSay(SAY_GARGAJO_INTOV1, LANG_UNIVERSAL, 0); break;
  227. case 1: me->MonsterSay(SAY_GARGAJO_INTOV2, LANG_UNIVERSAL, 0); break;
  228. case 2: case 3: case 4: break;
  229. }
  230.  
  231. Unit* moto = owner->GetVehicleBase();
  232.  
  233. if(moto && !moto->GetVehicleKit()->GetPassenger(2))
  234. me->EnterVehicle(moto,2);
  235. }
  236.  
  237. if(Entry == CREATURE_ACE) //As
  238. {
  239. switch (rand() % 6)
  240. {
  241. case 0: me->MonsterSay(SAY_AS_INTOV1, LANG_UNIVERSAL, 0); break;
  242. case 1: me->MonsterSay(SAY_AS_INTOV2, LANG_UNIVERSAL, 0); break;
  243. case 2: me->MonsterSay(SAY_AS_INTOV2, LANG_UNIVERSAL, 0); break;
  244. case 3: case 4: case 5: break;
  245. }
  246.  
  247. Unit* moto = owner->GetVehicleBase();
  248. if(moto && !moto->GetVehicleKit()->GetPassenger(1))
  249. me->EnterVehicle(moto,1);
  250. }
  251.  
  252. if(Entry == CREATURE_IZZY) //Izzy
  253. {
  254. switch (rand() % 3)
  255. {
  256. case 0: me->MonsterSay(SAY_IZZY_INTOV1, LANG_UNIVERSAL, 0); break;
  257. case 1: me->MonsterSay(SAY_IZZY_INTOV2, LANG_UNIVERSAL, 0); break;
  258. case 2: case 3: case 4: break;
  259. }
  260.  
  261. Unit* moto = owner->GetVehicleBase();
  262. if(moto && !moto->GetVehicleKit()->GetPassenger(3))
  263. me->EnterVehicle(moto,3);
  264. }
  265.  
  266. }
  267.  
  268. // Cada tres segudos regenerará un % de vida.
  269.  
  270. if (pasivePHReg <= diff)
  271. {
  272. me->SetHealth(me->GetHealth() + me->GetMaxHealth()/10);
  273. pasivePHReg = 8000;
  274. } else pasivePHReg -= diff;
  275.  
  276.  
  277.  
  278. //Si está en un vehículo
  279. if(me->GetVehicleBase())
  280. {
  281. if (timermo <= diff)
  282. {
  283. if(Entry == CREATURE_GOBBER) //Gordi
  284. {
  285. switch (rand() % 4)
  286. {
  287. case 0: me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); me->PlayDistanceSound(6943); break;
  288. case 1: me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); break;
  289. case 2: me->HandleEmoteCommand(EMOTE_ONESHOT_TALK); break;
  290. case 3: me->HandleEmoteCommand(EMOTE_ONESHOT_TALK); break;
  291. }
  292. }
  293. if(Entry == CREATURE_ACE) //As 23330
  294. {
  295. switch (rand() % 4)
  296. {
  297. case 0: me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);me->PlayDistanceSound(23330); break;
  298. case 1: me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); break;
  299. case 2: me->HandleEmoteCommand(EMOTE_ONESHOT_TALK); break;
  300. case 3: me->HandleEmoteCommand(EMOTE_ONESHOT_TALK); break;
  301. }
  302. }
  303.  
  304. if(Entry == CREATURE_IZZY)
  305. {
  306. switch (rand() % 4)
  307. {
  308. case 0: me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);me->PlayDistanceSound(19248); break;
  309. case 1: me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); break;
  310. case 2: me->HandleEmoteCommand(EMOTE_ONESHOT_TALK); break;
  311. case 3: me->HandleEmoteCommand(EMOTE_ONESHOT_TALK); break;
  312. }
  313. }
  314.  
  315. timermo = urand(3000,7000);
  316. } else timermo -= diff;
  317. }
  318. }
  319. };
  320.  
  321. CreatureAI* GetAI(Creature* creature) const
  322. {
  323. return new npc_trio_calatrabaAI(creature);
  324. }
  325. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement