project/Refactoring

From OpenKore Wiki
Revision as of 12:34, 17 October 2010 by ClementLambert (talk | contribs)
Jump to navigation Jump to search

Possible improvements.

Globals.pm

Move everything what makes a sense to Actors, ActorLists and new modules and wrap $messageSender->sendEverything to Actor/ActorList/etc methods.

Account-related

@chars $char
$accountID $sessionID $sessionID2 $accountSex $accountSex2 ...
$net $messageSender $charServer $conState $captcha_state ...
@ai_seq @ai_seq_args %ai_v $AI $AI_forcedOff ...

other permanent (not cleaned on relog) or out of mapserver or general connection-related stuff

=> new object $account->{...}

Next step:

=> list of accounts? (multiple bots per OK instance)

Character-related

%friends, @friendsID: ActorPlayerList $char->{friends}
$currentChatRoom: $char->{chatroom} link to chatroom in chatrooms list
@skillsID (list of character skills): $char->{skillsID} (already implemented for slaves; rename {slave_skillsID} to {skillsID}, too) [http://www.online-casino-gaming.org online gambling]
%guild (guild player list, ally/enemy guild list, guild info): ActorPlayerList $char->{guild}
%currentDeal (two item lists, info)
%shop, @articles, @venderListsID (our shop item list, shop info; another player's shop): ActorItemList $char->{shop}; ActorItemList $playerActor->{shop}

%cart (item list with cart info): ActorItemList $char->{cart}
%storage, @storageID (storage item list with storage info): ActorItemList $char->{storage}
$hotkeyList: ???
$questList: ???
$mailList (list of mail messages): new object, mail message

@cardMergeItemsID, $cardMergeIndex: ActorItemList $char->{something}
@arrowCraftID (list of possible items to use on): ActorItemList $char->{something}
@identifyID (list of possible items to use on): ActorItemList $char->{something}
$repairList (list of possible items to use on): ActorItemList $char->{something}
$cookingList: ActorItemList $char->{something}
  * these can also be just properties of inventory items

other character-binded temp. stuff and info: $char->{something}

Environment related

%targetTimeout (target×skill timeout): targetActor->{something} - NOT SO GOOD IDEA because Actor objects come and go
%chatRooms, @chatRoomsID, @currentChatRoomUsers (list of chatrooms, list of players in current): new object: Chatroom, with ActorPlayerList inside
@storeList (npc store): ActorItemList $actorNpc->{store}
@cashList (list of items in npc cash store): ActorItemList $actorNpc->{something}
%spells, @spellsID
$auctionList (list of auction entries): ???
$devotionList (source×target): ActorPlayerList inside sourceActor

Network::Send wrappers

sendAddSkillPoint: Skill->addPoint
sendAddStatusPoint: Actor::You->addStatusPoint(stat)
sendArrowCraft: Actor::Item->arrowCraft
sendAction attack: Actor->attack(target Actor)
sendAction sit/stand: Actor::You->sit/stand
sendAutoSpell: Skill->autoSpell
sendBanCheck: Account->banCheck
sendBuyBulk: Actor::NPC->???
sendBuyBulkVender: Actor::Player->???
sendCardMerge: Actor::Item->merge(target Actor::Item)
sendCardMergeRequest: Actor::Item->mergeRequest
sendCartAdd, sendCartGet, sendDrop: Actor::Item->move(target ActorItemList, amount)
sendCharCreate: Account->CharList->create(...)
sendCharDelete: ??? Account->CharList->delete(...)
sendCharLogin: Actor::You->login
sendChat: Actor::You->chat
sendChatRoomBestow: Chatroom->bestow(target Actor::Player)
sendChatRoomChange: Chatroom->change(...) OR auto send when updating Chatroom properties
sendChatRoomCreate: ChatroomList->create(...)
sendChatRoomJoin: Chatroom->join(password)
sendChatRoomKick: ??? Actor::Player->kickFromChatroom
sendChatRoomLeave: Chatroom->leave
sendCloseShop: Actor::You->Shop->close
sendHomunculusCommand: Actor::Homunculus->feed/fire
sendCompanionRelease: ???
sendCurrentDealCancel: Deal->cancel
sendDeal: Actor::Player->deal
sendDealReply: Deal->accept/cancel
sendDealAddItem: Deal->add(target Actor::Item)
sendDealFinalize: Deal->finalize
sendDealTrade: Deal->trade
sendEmotion: Actor::You->emotion(emotion)
sendEnteringVender: Actor::Player->venderRequest
sendEquip: Actor::Item->equip(slot)
sendFriendListReply: ???
sendFriendRequest: Actor::Player->friend
sendFriendRemove: ??? Actor::You->FriendList->delete(Actor::Player)
sendProduceMix: Actor::You->mix(Actor::Item, Actor::Item, Actor::Item, Actor::Item)
sendGameLogin: Account->login
sendGetCharacterName: ???
sendGetPlayerInfo: ???
sendNPCBuySellList: ??? Actor::NPC->store->request, Actor::NPC->sell->request
...