Difference between revisions of "project/Refactoring"

From OpenKore Wiki
Jump to navigation Jump to search
(Created page with 'Possible improvements. Move everything what makes a sense to Actors, ActorLists and wrap $messageSender->sendEverything to Actor/ActorList/etc methods. = Globals.pm = == Chara…')
 
m (Conversion script moved page Project/Refactoring to project/Refactoring: Converting page titles to lowercase)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
Possible improvements.
 
Possible improvements.
  
Move everything what makes a sense to Actors, ActorLists and wrap $messageSender->sendEverything to Actor/ActorList/etc methods.
+
= 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 ==
 +
 
 +
<pre>
 +
@chars $char
 +
$accountID $sessionID $sessionID2 $accountSex $accountSex2 ...
 +
$net $messageSender $charServer $conState $captcha_state ...
 +
@ai_seq @ai_seq_args %ai_v $AI $AI_forcedOff ...
  
= Globals.pm =
+
other permanent (not cleaned on relog) or out of mapserver or general connection-related stuff
 +
</pre>
 +
=> new object $account->{...}
 +
 
 +
Next step:
 +
 
 +
=> list of accounts? (multiple bots per OK instance)
  
 
== Character-related ==
 
== Character-related ==
Line 17: Line 33:
 
%cart (item list with cart info): ActorItemList $char->{cart}
 
%cart (item list with cart info): ActorItemList $char->{cart}
 
%storage, @storageID (storage item list with storage info): ActorItemList $char->{storage}
 
%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}
 
@cardMergeItemsID, $cardMergeIndex: ActorItemList $char->{something}
 
@arrowCraftID (list of possible items to use on): ActorItemList $char->{something}
 
@arrowCraftID (list of possible items to use on): ActorItemList $char->{something}
Line 22: Line 42:
 
$repairList (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}
 
$cookingList: ActorItemList $char->{something}
$hotkeyList: ???
+
  * these can also be just properties of inventory items
$questList: ???
+
 
$mailList (list of mail messages): new object, mail message
+
other character-binded temp. stuff and info: $char->{something}
 
</pre>
 
</pre>
  
Line 30: Line 50:
  
 
<pre>
 
<pre>
%targetTimeout (target×skill timeout): targetActor->{something}
+
%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
 
%chatRooms, @chatRoomsID, @currentChatRoomUsers (list of chatrooms, list of players in current): new object: Chatroom, with ActorPlayerList inside
 
@storeList (npc store): ActorItemList $actorNpc->{store}
 
@storeList (npc store): ActorItemList $actorNpc->{store}
Line 38: Line 58:
 
$devotionList (source×target): ActorPlayerList inside sourceActor
 
$devotionList (source×target): ActorPlayerList inside sourceActor
 
</pre>
 
</pre>
 +
 +
= Network::Send wrappers =
 +
 +
<pre>
 +
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
 +
...
 +
</pre>
 +
 +
[[Category:Development]]

Latest revision as of 22:35, 26 April 2021

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)
%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
...