void PopupMenu::handleLink(const std::string &link) { Being *being = actorSpriteManager->findBeing(mBeingId); // Talk To action if (link == "talk" && being && being->canTalk()) { being->talkTo(); } // Trade action else if (link == "trade" && being && being->getType() == ActorSprite::PLAYER) { Net::getTradeHandler()->request(being); tradePartnerName = being->getName(); } // Attack action else if (link == "attack" && being) { player_node->attack(being, true); } else if (link == "whisper" && being) { chatWindow->addInputText("/w \"" + being->getName() + "\" "); } else if (link == "unignore" && being && being->getType() == ActorSprite::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::NEUTRAL); } else if (link == "ignore" && being && being->getType() == ActorSprite::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::IGNORED); } else if (link == "disregard" && being && being->getType() == ActorSprite::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::DISREGARDED); } else if (link == "friend" && being && being->getType() == ActorSprite::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::FRIEND); } // Guild action else if (link == "guild" && being && being->getType() == ActorSprite::PLAYER) { player_node->inviteToGuild(being); } // Follow Player action else if (link == "follow" && being) { player_node->setFollow(being->getName()); } // Pick Up Floor Item action else if ((link == "pickup") && mFloorItem) { player_node->pickUp(mFloorItem); } // Look To action else if (link == "look") { } else if (link == "use") { assert(mItem); if (mItem->isEquipment()) { if (mItem->isEquipped()) Net::getInventoryHandler()->unequipItem(mItem); else Net::getInventoryHandler()->equipItem(mItem); } else { Net::getInventoryHandler()->useItem(mItem); } } else if (link == "chat") { if (mItem) chatWindow->addItemText(mItem->getInfo().getName()); else if (mFloorItem) chatWindow->addItemText(mFloorItem->getInfo().getName()); } else if (link == "split") { ItemAmountWindow::showWindow(ItemAmountWindow::ItemSplit, inventoryWindow, mItem); } else if (link == "drop") { ItemAmountWindow::showWindow(ItemAmountWindow::ItemDrop, inventoryWindow, mItem); } else if (link == "store") { ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, inventoryWindow, mItem); } else if (link == "retrieve") { ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove, mWindow, mItem); } else if (link == "party" && being && being->getType() == ActorSprite::PLAYER) { Net::getPartyHandler()->invite(being); } else if (link == "name" && being) { const std::string &name = being->getName(); chatWindow->addInputText(name); } else if (link == "admin-kick" && being && (being->getType() == ActorSprite::PLAYER || being->getType() == ActorSprite::MONSTER)) { Net::getAdminHandler()->kick(being->getId()); } // Unknown actions else if (link != "cancel") { logger->log("PopupMenu: Warning, unknown action '%s'", link.c_str()); } setVisible(false); mBeingId = 0; mFloorItem = NULL; mItem = NULL; }