Guest User

Untitled

a guest
Nov 19th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.98 KB | None | 0 0
  1. //After
  2.  
  3. enum playerinfo_t {
  4.  
  5. //Add this
  6.  
  7. PLAYERINFO_LEVEL,
  8.  
  9. //After
  10.  
  11. #define PLAYER_MIN_SPEED 10
  12.  
  13. //Add this
  14.  
  15. struct PlayerCast //Cast System Felipe MOnteiro
  16. {
  17. uint16_t curId;
  18. uint16_t specId;
  19. bool isCasting;
  20. std::string password;
  21.  
  22. int mCastChannelId;
  23. PlayerCast() {
  24. mCastChannelId = -1;
  25. isCasting = false;
  26. curId = 1;
  27. specId = 1;
  28. password = "";
  29. }
  30. };
  31.  
  32. template <class T> //Cast System Felipe Monteiro
  33. class AutoList : public std::map<uint32_t, T*> //Cast System Felipe Monteiro
  34. {
  35.  
  36. };
  37.  
  38. //After
  39.  
  40. class Player : public Creature, public Cylinder
  41. {
  42.  
  43. //Add this
  44.  
  45. public:
  46. AutoList<ProtocolGame> cSpectators;
  47. uint32_t nextSpectator;
  48. PlayerCast cast;
  49.  
  50. bool getCastingState() const;
  51. void setCasting(bool castStatus);
  52. virtual const std::string& getCastingPassword(){
  53. return cast.password;
  54. }
  55.  
  56. PlayerCast getCast();
  57. void setCastPassword(std::string password_);
  58.  
  59. void addCastViewer(ProtocolGame* pg);
  60. void removeCastViewer(uint32_t id);
  61. uint32_t getCastIpByName(std::string n);
  62.  
  63. uint32_t getCastViewerCount() const;
  64.  
  65. void kickCastViewers();
  66.  
  67. bool kickCastViewerByName(std::string n);
  68.  
  69. //After
  70.  
  71. void sendFYIBox(const std::string& message) {
  72.  
  73. //Add this
  74.  
  75. for (auto it : cSpectators)
  76. it.second->sendFYIBox(message);
  77.  
  78. //After
  79.  
  80. void sendCreatureSkull(const Creature* creature) const {
  81.  
  82. //Add this
  83.  
  84. for (auto it : cSpectators)
  85. it.second->sendCreatureSkull(creature);
  86.  
  87. //After
  88.  
  89. void sendAddTileItem(const Tile* tile, const Position& pos, const Item* item) {
  90.  
  91. //Add this
  92.  
  93. for (auto it : cSpectators){
  94. int32_t stackpos = tile->getStackposOfThing(this, item);
  95. if (stackpos != -1) {
  96. it.second->sendAddTileItem(pos, stackpos, item);
  97. }
  98. }
  99.  
  100. //After
  101.  
  102. void sendUpdateTileItem(const Tile* tile, const Position& pos, const Item* item) {
  103.  
  104. //Add this
  105.  
  106. for (auto it : cSpectators){
  107. int32_t stackpos = tile->getStackposOfThing(this, item);
  108. if (stackpos != -1) {
  109. it.second->sendUpdateTileItem(pos, stackpos, item);
  110. }
  111. }
  112.  
  113. //After
  114.  
  115. void sendRemoveTileThing(const Position& pos, int32_t stackpos) {
  116.  
  117. //Add this
  118.  
  119. for (auto it : cSpectators)
  120. it.second->sendRemoveTileThing(pos, stackpos);
  121.  
  122. //After
  123.  
  124. void sendUpdateTile(const Tile* tile, const Position& pos) {
  125.  
  126. //Add this
  127.  
  128. for (auto it : cSpectators)
  129. it.second->sendUpdateTile(tile, pos);
  130.  
  131. //After
  132.  
  133. void sendChannelMessage(const std::string& author, const std::string& text, SpeakClasses type, uint16_t channel) {
  134.  
  135. //Add this
  136.  
  137. for (auto it : cSpectators)
  138. it.second->sendChannelMessage(author, text, type, channel);
  139.  
  140. //After
  141.  
  142. void sendChannelEvent(uint16_t channelId, const std::string& playerName, ChannelEvent_t channelEvent) {
  143.  
  144. //Add this
  145.  
  146. for (auto it : cSpectators)
  147. it.second->sendChannelEvent(channelId, playerName, channelEvent);
  148.  
  149. //After
  150.  
  151. void sendCreatureAppear(const Creature* creature, const Position& pos, bool isLogin) {
  152.  
  153. //Add this
  154.  
  155. for (auto it : cSpectators)
  156. it.second->sendAddCreature(creature, pos, creature->getTile()->getStackposOfCreature(this, creature), isLogin);
  157.  
  158. //After
  159.  
  160. void sendCreatureMove(const Creature* creature, const Position& newPos, int32_t newStackPos, const Position& oldPos, int32_t oldStackPos, bool teleport) {
  161.  
  162. //Add this
  163.  
  164. for (auto it : cSpectators)
  165. it.second->sendMoveCreature(creature, newPos, newStackPos, oldPos, oldStackPos, teleport);
  166.  
  167. //After
  168.  
  169. void sendCreatureTurn(const Creature* creature) {
  170.  
  171. //Add this
  172.  
  173. for (auto it : cSpectators) { //Cast System Felipe Monteiro
  174. int32_t stackpos = creature->getTile()->getStackposOfCreature(this, creature);
  175. if (stackpos != -1) {
  176. it.second->sendCreatureTurn(creature, stackpos);
  177. }
  178. }
  179.  
  180. //After
  181.  
  182. void sendCreatureSay(const Creature* creature, SpeakClasses type, const std::string& text, const Position* pos = nullptr) {
  183.  
  184. //Add this
  185.  
  186. for (auto it : cSpectators)
  187. it.second->sendCreatureSay(creature, type, text, pos);
  188.  
  189. //After
  190.  
  191. void sendPrivateMessage(const Player* speaker, SpeakClasses type, const std::string& text) {
  192.  
  193. //Add this
  194.  
  195. for (auto it : cSpectators)
  196. it.second->sendPrivateMessage(speaker, type, text);
  197.  
  198. //After
  199.  
  200. void sendCreatureSquare(const Creature* creature, SquareColor_t color) {
  201.  
  202. //Add this
  203.  
  204. for (auto it : cSpectators)
  205. it.second->sendCreatureSquare(creature, color);
  206.  
  207. //After
  208.  
  209. void sendCreatureChangeOutfit(const Creature* creature, const Outfit_t& outfit) {
  210.  
  211. //Add this
  212.  
  213. for (auto it : cSpectators)
  214. it.second->sendCreatureOutfit(creature, outfit);
  215.  
  216. //After
  217.  
  218. if (creature->getPlayer()) {
  219. if (visible) {
  220.  
  221. //Add this
  222.  
  223. for (auto it : cSpectators)
  224. it.second->sendCreatureOutfit(creature, creature->getCurrentOutfit());
  225.  
  226. //After
  227.  
  228. static Outfit_t outfit;
  229.  
  230. //Add this
  231.  
  232. for (auto it : cSpectators)
  233. it.second->sendCreatureOutfit(creature, outfit);
  234.  
  235. //After
  236.  
  237. } else if (canSeeInvisibility()) {
  238.  
  239. //Add this
  240.  
  241. for (auto it : cSpectators)
  242. it.second->sendCreatureOutfit(creature, creature->getCurrentOutfit());
  243.  
  244. //Before
  245.  
  246. client->sendAddCreature(creature, creature->getPosition(), stackpos, false);
  247.  
  248. //Add this
  249.  
  250. for (auto it : cSpectators)
  251. it.second->sendAddCreature(creature, creature->getPosition(), stackpos, false);
  252.  
  253. //Before
  254.  
  255. client->sendRemoveTileThing(creature->getPosition(), stackpos);
  256.  
  257. //Add this
  258.  
  259. for (auto it : cSpectators)
  260. it.second->sendRemoveTileThing(creature->getPosition(), stackpos);
  261.  
  262. //After
  263.  
  264. void sendCreatureLight(const Creature* creature) {
  265.  
  266. //Add this
  267.  
  268. for (auto it : cSpectators)
  269. it.second->sendCreatureLight(creature);
  270.  
  271. //After
  272.  
  273. void sendCreatureWalkthrough(const Creature* creature, bool walkthrough) {
  274.  
  275. //Add this
  276.  
  277. for (auto it : cSpectators)
  278. it.second->sendCreatureWalkthrough(creature, walkthrough);
  279.  
  280. //After
  281.  
  282. void sendCreatureShield(const Creature* creature) {
  283.  
  284. //Add this
  285.  
  286. for (auto it : cSpectators)
  287. it.second->sendCreatureShield(creature);
  288.  
  289. //After
  290.  
  291. void sendCreatureType(uint32_t creatureId, uint8_t creatureType) {
  292.  
  293. //Add this
  294.  
  295. for (auto it : cSpectators)
  296. it.second->sendCreatureType(creatureId, creatureType);
  297.  
  298. //After
  299.  
  300. void sendCreatureHelpers(uint32_t creatureId, uint16_t helpers) {
  301.  
  302. //Add this
  303.  
  304. for (auto it : cSpectators)
  305. it.second->sendCreatureHelpers(creatureId, helpers);
  306.  
  307. //After
  308.  
  309. void sendSpellCooldown(uint8_t spellId, uint32_t time) {
  310.  
  311. //Add this
  312.  
  313. for (auto it : cSpectators)
  314. it.second->sendSpellCooldown(spellId, time);
  315.  
  316. //After
  317.  
  318. void sendSpellGroupCooldown(SpellGroup_t groupId, uint32_t time) {
  319.  
  320. //Add this
  321.  
  322. for (auto it : cSpectators)
  323. it.second->sendSpellGroupCooldown(groupId, time);
  324.  
  325. //After
  326.  
  327. void sendDamageMessage(MessageClasses mclass, const std::string& message, const Position& pos,
  328. uint32_t primaryDamage = 0, TextColor_t primaryColor = TEXTCOLOR_NONE,
  329. uint32_t secondaryDamage = 0, TextColor_t secondaryColor = TEXTCOLOR_NONE) {
  330.  
  331. //Add this
  332.  
  333. for (auto it : cSpectators)
  334. it.second->sendDamageMessage(mclass, message, pos, primaryDamage, primaryColor, secondaryDamage, secondaryColor);
  335.  
  336. //After
  337.  
  338. void sendHealMessage(MessageClasses mclass, const std::string& message, const Position& pos, uint32_t heal, TextColor_t color) {
  339.  
  340. //Add this
  341.  
  342. for (auto it : cSpectators)
  343. it.second->sendHealMessage(mclass, message, pos, heal, color);
  344.  
  345. //After
  346.  
  347. void sendExperienceMessage(MessageClasses mclass, const std::string& message, const Position& pos, uint32_t exp, TextColor_t color) {
  348.  
  349. //Add this
  350.  
  351. for (auto it : cSpectators)
  352. it.second->sendExperienceMessage(mclass, message, pos, exp, color);
  353.  
  354. //After
  355.  
  356. void sendContainer(uint8_t cid, const Container* container, bool hasParent, uint16_t firstIndex) {
  357.  
  358. //Add this
  359.  
  360. for (auto it : cSpectators)
  361. it.second->sendContainer(cid, container, hasParent, firstIndex);
  362.  
  363. //After
  364.  
  365. void sendInventoryItem(slots_t slot, const Item* item) {
  366.  
  367. //Add this
  368.  
  369. for (auto it : cSpectators)
  370. it.second->sendInventoryItem(slot, item);
  371.  
  372. //After
  373.  
  374. void sendCancel(const std::string& msg) const {
  375.  
  376. //Add this
  377.  
  378. for (auto it : cSpectators)
  379. it.second->sendTextMessage(MESSAGE_STATUS_SMALL, msg);
  380.  
  381. //After
  382.  
  383. void sendCancelTarget() const {
  384.  
  385. //Add this
  386.  
  387. for (auto it : cSpectators)
  388. it.second->sendCancelTarget();
  389.  
  390. //After
  391.  
  392. void sendCancelWalk() const {
  393.  
  394. //Add this
  395.  
  396. for (auto it : cSpectators) //Cast System Felipe Monteiro
  397. it.second->sendCancelWalk();
  398.  
  399. //After
  400.  
  401. void sendChangeSpeed(const Creature* creature, uint32_t newSpeed) const {
  402.  
  403. /Add this
  404.  
  405. for (auto it : cSpectators)
  406. it.second->sendChangeSpeed(creature, newSpeed);
  407.  
  408. //After
  409.  
  410. void sendCreatureHealth(const Creature* creature) const {
  411.  
  412. //Add this
  413.  
  414. for (auto it : cSpectators)
  415. it.second->sendCreatureHealth(creature);
  416.  
  417. //After
  418.  
  419. void sendDistanceShoot(const Position& from, const Position& to, unsigned char type) const {
  420.  
  421. //Add this
  422.  
  423. for (auto it : cSpectators)
  424. it.second->sendDistanceShoot(from, to, type);
  425.  
  426. //After
  427.  
  428. void sendCreatePrivateChannel(uint16_t channelId, const std::string& channelName) {
  429.  
  430. //Add this
  431.  
  432. for (auto it : cSpectators)
  433. it.second->sendCreatePrivateChannel(channelId, channelName);
  434.  
  435. //After
  436.  
  437. void sendIcons() const {
  438.  
  439. //Add this
  440.  
  441. for (auto it : cSpectators)
  442. it.second->sendIcons(getClientIcons());
  443.  
  444. //After
  445.  
  446. void sendMagicEffect(const Position& pos, uint8_t type) const {
  447.  
  448. //Add this
  449.  
  450. for (auto it : cSpectators)
  451. it.second->sendMagicEffect(pos, type);
  452.  
  453. //After
  454.  
  455. void sendPingBack() const {
  456.  
  457. //Add this
  458.  
  459. for (auto it : cSpectators)
  460. it.second->sendPingBack();
  461.  
  462. //After
  463.  
  464. void sendBasicData() const {
  465.  
  466. //Add this
  467.  
  468. for (auto it : cSpectators)
  469. it.second->sendBasicData();
  470.  
  471. //After
  472.  
  473. void sendSkills() const {
  474.  
  475. //Add this
  476.  
  477. for (auto it : cSpectators)
  478. it.second->sendSkills();
  479.  
  480. //After
  481.  
  482. void sendTextMessage(MessageClasses mclass, const std::string& message, Position* pos = nullptr, uint32_t value = 0, TextColor_t color = TEXTCOLOR_NONE) const {
  483.  
  484. //Add this
  485.  
  486. for (auto it : cSpectators)
  487. it.second->sendTextMessage(mclass, message, pos, value, color);
  488.  
  489. //After
  490.  
  491. void sendTextMessage(const TextMessage& message) const {
  492.  
  493. //Add this
  494.  
  495. for (auto it : cSpectators)
  496. it.second->sendTextMessage(message);
  497.  
  498. //After
  499.  
  500. void sendReLoginWindow(uint8_t unfairFightReduction) const {
  501.  
  502. //Add this
  503.  
  504. for (auto it : cSpectators)
  505. it.second->sendReLoginWindow(unfairFightReduction);
  506.  
  507. //After
  508.  
  509. void sendTextWindow(Item* item, uint16_t maxlen, bool canWrite) const {
  510.  
  511. //Add this
  512.  
  513. for (auto it : cSpectators)
  514. it.second->sendTextWindow(windowTextId, item, maxlen, canWrite);
  515.  
  516. //After
  517.  
  518. void sendTextWindow(uint32_t itemId, const std::string& text) const {
  519.  
  520. //Add this
  521.  
  522. for (auto it : cSpectators)
  523. it.second->sendTextWindow(windowTextId, itemId, text);
  524.  
  525. //After
  526.  
  527. if (client) {
  528. client->sendTextWindow(windowTextId, itemId, text);
  529. }
  530. }
  531.  
  532. //Add this
  533.  
  534. void sendToChannel(ProtocolGame* from, const std::string& text) {
  535. for (auto it : cSpectators)
  536. it.second->sendToChannel(from, text);
  537. if (client)
  538. client->sendToChannel(from, text);
  539. }
  540.  
  541. //After
  542.  
  543. void sendToChannel(const Creature* creature, SpeakClasses type, const std::string& text, uint16_t channelId) const {
  544.  
  545. //Add this
  546.  
  547. for (auto it : cSpectators)
  548. it.second->sendToChannel(creature, type, text, channelId);
  549.  
  550. //After
  551.  
  552. void sendShop(Npc* npc) const {
  553.  
  554. //Add this
  555.  
  556. for (auto it : cSpectators)
  557. it.second->sendShop(npc, shopItemList);
  558.  
  559. //After
  560.  
  561. void sendSaleItemList() const {
  562.  
  563. //Add this
  564.  
  565. for (auto it : cSpectators)
  566. it.second->sendSaleItemList(shopItemList);
  567.  
  568. //After
  569.  
  570. void sendCloseShop() const {
  571.  
  572. //Add this
  573.  
  574. for (auto it : cSpectators)
  575. it.second->sendCloseShop();
  576.  
  577. //After
  578.  
  579. void sendMarketEnter(uint32_t depotId) const {
  580.  
  581. //Add this
  582.  
  583. for (auto it : cSpectators)
  584. it.second->sendMarketEnter(depotId);
  585.  
  586. //After
  587.  
  588. void sendMarketLeave() {
  589. inMarket = false;
  590.  
  591. //Add this
  592.  
  593. for (auto it : cSpectators)
  594. it.second->sendMarketLeave();
  595.  
  596. //After
  597.  
  598. void sendMarketBrowseItem(uint16_t itemId, const MarketOfferList& buyOffers, const MarketOfferList& sellOffers) const {
  599.  
  600. //Add this
  601.  
  602. for (auto it : cSpectators)
  603. it.second->sendMarketBrowseItem(itemId, buyOffers, sellOffers);
  604.  
  605. //After
  606.  
  607. void sendMarketBrowseOwnOffers(const MarketOfferList& buyOffers, const MarketOfferList& sellOffers) const {
  608.  
  609. //Add this
  610.  
  611. for (auto it : cSpectators)
  612. it.second->sendMarketBrowseOwnOffers(buyOffers, sellOffers);
  613.  
  614. //After
  615.  
  616. void sendMarketBrowseOwnHistory(const HistoryMarketOfferList& buyOffers, const HistoryMarketOfferList& sellOffers) const {
  617.  
  618. //Add this
  619.  
  620. for (auto it : cSpectators)
  621. it.second->sendMarketBrowseOwnHistory(buyOffers, sellOffers);
  622.  
  623. //After
  624.  
  625. void sendMarketDetail(uint16_t itemId) const {
  626.  
  627. //Add this
  628.  
  629. for (auto it : cSpectators)
  630. it.second->sendMarketDetail(itemId);
  631.  
  632. //After
  633.  
  634. void sendMarketAcceptOffer(const MarketOfferEx& offer) const {
  635.  
  636. //Add this
  637.  
  638. for (auto it : cSpectators)
  639. it.second->sendMarketAcceptOffer(offer);
  640.  
  641. //After
  642.  
  643. void sendMarketCancelOffer(const MarketOfferEx& offer) const {
  644.  
  645. //Add this
  646.  
  647. for (auto it : cSpectators)
  648. it.second->sendMarketCancelOffer(offer);
  649.  
  650. //After
  651.  
  652. void sendTradeItemRequest(const Player* player, const Item* item, bool ack) const {
  653.  
  654. //Add this
  655.  
  656. for (auto it : cSpectators)
  657. it.second->sendTradeItemRequest(player, item, ack);
  658.  
  659. //After
  660.  
  661. void sendTradeClose() const {
  662.  
  663. //Add this
  664.  
  665. for (auto it : cSpectators)
  666. it.second->sendCloseTrade();
  667.  
  668. //After
  669.  
  670. void sendWorldLight(const LightInfo& lightInfo) {
  671.  
  672. //Add this
  673.  
  674. for (auto it : cSpectators)
  675. it.second->sendWorldLight(lightInfo);
  676.  
  677. //After
  678.  
  679. void sendChannelsDialog() {
  680.  
  681. //Add this
  682.  
  683. for (auto it : cSpectators)
  684. it.second->sendChannelsDialog();
  685.  
  686. //After
  687.  
  688. void sendOpenPrivateChannel(const std::string& receiver) {
  689.  
  690. //Add this
  691.  
  692. for (auto it : cSpectators)
  693. it.second->sendOpenPrivateChannel(receiver);
  694.  
  695. //After
  696.  
  697. void sendOutfitWindow() {
  698.  
  699. //Add this
  700.  
  701. for (auto it : cSpectators)
  702. it.second->sendOutfitWindow();
  703.  
  704. //After
  705.  
  706. void sendCloseContainer(uint8_t cid) {
  707.  
  708. //Add this
  709.  
  710. for (auto it : cSpectators)
  711. it.second->sendCloseContainer(cid);
  712.  
  713. //After
  714.  
  715. void sendChannel(uint16_t channelId, const std::string& channelName, const UsersMap* channelUsers, const InvitedMap* invitedUsers) {
  716.  
  717. //Add this
  718.  
  719. for (auto it : cSpectators)
  720. it.second->sendChannel(channelId, channelName, channelUsers, invitedUsers);
  721.  
  722. //After
  723.  
  724. void sendTutorial(uint8_t tutorialId) {
  725.  
  726. //Add this
  727.  
  728. for (auto it : cSpectators)
  729. it.second->sendTutorial(tutorialId);
  730.  
  731. //After
  732.  
  733. void sendAddMarker(const Position& pos, uint8_t markType, const std::string& desc) {
  734.  
  735. //Add this
  736.  
  737. for (auto it : cSpectators)
  738. it.second->sendAddMarker(pos, markType, desc);
  739.  
  740. //After
  741.  
  742. void sendQuestLog() {
  743.  
  744. //Add this
  745.  
  746. for (auto it : cSpectators)
  747. it.second->sendQuestLog();
  748.  
  749. //After
  750.  
  751. void sendQuestLine(const Quest* quest) {
  752.  
  753. //Add this
  754.  
  755. for (auto it : cSpectators)
  756. it.second->sendQuestLine(quest);
  757.  
  758. //After
  759.  
  760. void sendEnterWorld() {
  761.  
  762. //Add this
  763.  
  764. for (auto it : cSpectators)
  765. it.second->sendEnterWorld();
  766.  
  767. //After
  768.  
  769. void sendFightModes() {
  770.  
  771. //Add this
  772.  
  773. for (auto it : cSpectators)
  774. it.second->sendFightModes();
  775.  
  776. //After
  777.  
  778. void sendNetworkMessage(const NetworkMessage& message) {
  779.  
  780. //Add this
  781.  
  782. for (auto it : cSpectators)
  783. it.second->writeToOutputBuffer(message);
Advertisement
Add Comment
Please, Sign In to add comment